Forum Moderators: coopster

Message Too Old, No Replies

Help with formatting date

         

adammc

3:38 am on Mar 27, 2007 (gmt 0)

10+ Year Member



Hi guys,

I am currently storing a date in my MYSQL DB:
[php]date_reg DATETIME NOT NULL default '0000-00-00 00:00:00', [/php]

I want to extract it into the correct format using an echo statement rather than doing the formatting in the SQl query.

Something like this:
[php]<?echo date("M j, Y", $row['date_reg'])?>[/php]

But as you can guess its coming out all screwy (Dec 31, 1969)
Can anyone possibly help?

adammc

4:01 am on Mar 27, 2007 (gmt 0)

10+ Year Member



I got it sorted using:
echo date('M j, Y', strtotime($row['date_reg']));