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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format date from ACCESS database

Status
Not open for further replies.

ELVIS

MIS
Nov 6, 1999
13
IL
I'm a 'newbie' with a quick question:

I have an ACCESS database and am using a SQL statement to retrieve data.

sql = "SELECT * FROM users WHERE surname Like '" & startletter & "%' ORDER BY lastname"

I now have a table that has the following asp code:

<%=rsUsers("date")%>

This returns a date which reads something like this:

1/10/2007 12:58:36 PM

How do I get it to show the date only? i.e., 1/10/2007 ?

Thanks
 
Thanks, but how do I integrate the two codes?

I have the ACCESS data: <%=rsUsers("date")%>

How do I use the script:
document.write(FormatDateTime(Date(),2))

 
document.write(FormatDateTime([!]rsUsers("date")[/!], 2))

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
since using access...a built-in may work for you(i imagine based on what version)...very nice to have since you can use the formats in access or customize your own..ie -

Code:
sql = "SELECT Format(date,""short date"") AS FormatedDate FROM users;"

'1/10/2007 

sql = "SELECT Format(date,""m.d.yy"") AS FormatedDate FROM users;"

'1.10.07

sql = "SELECT Format(date,""dd-mm-yyyy"") AS FormatedDate FROM users;"

'10-01-2007




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top