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

Format date

Status
Not open for further replies.

ludde

Programmer
Joined
Jun 15, 2000
Messages
2
Location
SE
I wonder how to format a date M/D/YY to the format YYYY-MM-DD? Best of all would be if I can do the format in the sql statement that I send to an access database to get the date.<br><br>Thanks,<br><br>Ludde
 
Try this SQL:<br><br>Select TO_DATE('datefield','yyyy-mm-dd') where ....
 
As Daniel's example shows, you can have the date value returned in your recordset if your database supports it (not all do).&nbsp;&nbsp;<br><br>VBscript has a FormatDate function,&nbsp;&nbsp;but you have to use one of the predefined formats.&nbsp;&nbsp;Otherwise,&nbsp;&nbsp;you have to do it manually.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Just putting in my 2 cents<br><br>Having worked with Access database for years I found that if you want to put a date in a field with the &quot;Date&quot; type <br>I use the following with excellent results<br><br>rs!MyDateField = Format(now(),&quot;mm/dd/yy&quot;)<br><br>Access does not like it any other way.<br>Now if you want the date to Appear as 2000-07-06 then format the output not the input. <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top