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

Date formatting and conversion

Status
Not open for further replies.

sknyppy

Programmer
May 14, 1999
137
US
I have a datetime field that contains the value
"2002-08-15 13:00:00" but when I display the variable or try to copy it to another table it automatically converts to this format: "8/15/2002 1:00:00 PM".

How can I retain the initial formatting of the value when I display or copy this value?

I'm using mySQL/ASP for database and programming.

Thanks,
Dave


 
try the date_format function

SELECT DATE_FORMAT(datefield, '%Y-%m-%d %H:%i:%S') FROM tablename

INSERT INTO to_table SELECT DATE_FORMAT(datefield, '%Y-%m-%d %H:%i:%S') FROM from_table

but i'm not sure if mysql displays after insert the date in this format :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top