Link to home
Start Free TrialLog in
Avatar of details212
details212

asked on

Format Date from a Recordset

Hello All

I am trying to format the date returned from a recordset.  It's coming from microsoft access like this : 10/20/2009 11:52:02 PM

I am looking to write it out in the w3c standard.  The accepted date format that I need it in is:
2009-10-20
Year-Month(2 digit)-Dar(2 digit)

Thank you
ASKER CERTIFIED SOLUTION
Avatar of jamesrh
jamesrh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hielo
>>I am trying to format the date returned from a recordset.  It's coming from microsoft access like this : 10/20/2009 11:52:02 PM
assuming the name of your field is purchasedOn, instead of executing:
SELECT purchasedOn FROM tableName

use:
SELECT FORMAT([purchasedOn],"yyyy-mm-dd") as [purchaseDate] FROM tableName

On your recordset:
rs.Fields("purchaseDate").value

will have the formatted date
Avatar of details212
details212

ASKER

Link to another Post