Hi, Friday, October 11, 2002, 3:53:55 PM, you wrote: JP> I am at my wits end at the moment. I am pulling a datetimestamp out of a JP> database and attempting to get the year month and day out of it. However JP> I am stumped as how to do it.
JP> The format is "YYYY-MM-DD HH:MM:SS" and its coming out of a mySQL JP> database. Is there anyway I can get the information I need out of here? JP> I have tried $nday = date("d", $row[2]) and so on but all i get out of JP> that is Year = 1970, Month = 01, Day = 01. JP> Heres the code Im using now with getdate() JP> while($row = mysql_fetch_row($fres)) JP> { JP> print($row[2]); JP> $odate = getdate($row[2]); JP> print($odate['mday']."<br />"); JP> $oday = date("d", $odate); JP> print($odate['mon']."<br />"); JP> $omonth = date("m", $odate); JP> print($odate['year']."<br />"); JP> $oyear = date("Y", $odate); JP> print($oyear."<br />"); JP> } JP> Any help would be appreciated. JP> James Try this $ts = strtotime($row[2]);//get a unix timestamp $day = date("d",$ts); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php