Page 1 of 1

change data time format

Posted: Wed Apr 09, 2003 9:20 pm
by theclay7
when I retrieve my date and time from database and display as follow:

2003-03-14 14:42:18

How can I easily change the format into :

Mar 14th, 2003, 2:42pm

Posted: Thu Apr 10, 2003 2:24 am
by twigletmac
If you're using MySQL:

Code: Select all

SELECT DATE_FORMAT(datefield, '%b %D, %Y, %l:%i%p') AS date FROM table
For more info on DATE_FORMAT:
http://www.mysql.com/doc/en/Date_and_ti ... ml#IDX1298

Mac