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!

MySQL timestamp convert

Status
Not open for further replies.

kpdvx

Programmer
Dec 1, 2001
87
US
2002-5-10 12:22:33

how can i convert this to say,
Tuesday, May 10th, 2002, 12:22pm ?

any ideas?
 
One way would be for MySQL to convert it for you, using the date_format() builtin function:

Assuming column b contains 20020620233544 in a timestamp field, then:

select date_format(b, '%W, %M %D, %Y, %l:%i%p') as date from foo;

will return:

"Thursday, June 20th, 2002, 11:35PM" in a recordset column named "date" ______________________________________________________________________
Perfection in engineering does not happen when there is nothing more to add.
Rather it happens when there is nothing more to take away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top