Page 1 of 1

trouble formatting date stored in MYSQL

Posted: Sat Oct 22, 2005 5:43 pm
by kristie380
HELP! I am trying to post the date that is stored in MYSQL onto my php page but it just keeps returning Dec. 31, 1969. What am I doing wrong? Here is my code:

Code: Select all

$date = explode("-", $date_modified);
$final_date = date("M d Y", mktime(0,0,0,$date[0],$date[1],$date[2]));

Posted: Sat Oct 22, 2005 5:49 pm
by feyd
dates in MySQL are stored in YYYY-MM-DD format.

Code: Select all

$date = explode("-", $date_modified);
$final_date = date("M d Y", mktime(0,0,0,$date[1],$date[2],$date[0]));

Posted: Sat Oct 22, 2005 7:56 pm
by kristie380
Thanks! I always miss something small like that :)