I am at my wits end at the moment. I am pulling a datetimestamp out of a 
database and attempting to get the year month and day out of it. However 
  I am stumped as how to do it.

The format is "YYYY-MM-DD HH:MM:SS" and its coming out of a mySQL 
database. Is there anyway I can get the information I need out of here?

I have tried $nday = date("d", $row[2]) and so on but all i get out of 
that is Year = 1970, Month = 01, Day = 01.

Heres the code Im using now with getdate()

while($row = mysql_fetch_row($fres))
{
        print($row[2]);
        $odate = getdate($row[2]);
        print($odate['mday']."<br />");
        $oday = date("d", $odate);
        print($odate['mon']."<br />");
        $omonth = date("m", $odate);
        print($odate['year']."<br />");
        $oyear = date("Y", $odate);
        print($oyear."<br />");
}

Any help would be appreciated.

James
                


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to