Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format

Status
Not open for further replies.

SteveHigh

Technical User
Jan 17, 2007
158
0
0
GB
Hello

I have an MS Access (2000) database which includes a column called 'Date'. In it, are the following:

29 June 2003
13 September 2005
23 July 2007

When I look at the records online, however, I see:

Date = 6/29/2003
Date = 9/13/2005
Date = 7/23/2007

I do not know where - or why - this transformation takes place, but how can I force the server (or whatever is responsible for the 'change') to recognise:

29 June 2003
13 September 2005
23 July 2007

in fact, ideally, I would prefer

29th June 2003
13th September 2005
23rd July 2007

etc, (and without the word 'Date appearing) but Access does not appear to allow me to write the date in that format.

Any suggestions would be appreciated.

Many thanks.

Steve
 
Access is both a front-end and a back-end for the database (sort of). In the front-end it is showing you a default format for the date data. ASP is doing the same. Unfortunatly MS Access's default format looks like "dd MMM yyyy" and VBScript's default format is vbShortDate or (mm/dd/yyyy). There are very limited options available to you from VBScript to format a date (see FormatDateTime function).

One option (if it works) would be to change the dateformat inside your SQL statement, which would allow you to use the MS Access formats rather than the VBScript formats. The upside of this is more format capability, the downside is that you will have a string in your recordset instead of a DateTime field, since the output of a date formatting function is a string (text).

-T
 
Hello Tarwn

Many thanks for your message and link.

So would I need to use something like:

<% =VBLongDate("", 1) %> ?

At the moment, my code is:

While NOT TBL.EOF

Response.Write("Name = " & TBL("Name") & "<br>")
Response.Write("Surname = " & TBL("Surname") & "<br>")
Response.Write("Country = " & TBL("Country") & "<br>")
Response.Write("Hobbies = " & TBL("Hobbies") & "<br>")
Response.Write("Date = " & TBL("Date") & "<br><br><br>")
TBL.MoveNext
Wend

I am not too sure where I would use the

<% =VBLongDate("", 1) %> ?

The "Date" I have in the Response.Write statement above refers to the name of the column in the MS mdb.

Thank again.

Steve


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top