Thanks John, your answer is right on the $$$. Changing the query to something like : SELECT UNIX_TIMESTAMP(ProblemStart) as ProblemStart
solved the problem. Do i feel sheepish... actually double sheepish cause i already solved this long ago and forgot about it :( Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Sunday, July 13, 2003 5:01 PM To: Boaz Yahav Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Weird Date problem driving me crazy... Boaz Yahav wrote: > I have two date strings coming out from MySQL. > Both fields are defined as datetime. > > When i come to print them like this : > > Echo"<B>Ticket Opened</B> : " . date("l, F jS Y > H:i",$row->OpenDate) . "<BR>"; > Echo"<B>Problem Start</B> : " . date("l, F jS Y > H:i",$row->ProblemStart) . "<BR>"; > > I get : > > Ticket Opened : Sunday, July 13th 2003 13:37 > Problem Start : Thursday, January 1st 1970 02:33 > > Notice that the 2nd date is wrong and it's some kind of default that > the function returns. Only if i add strtotime() and only to the 2nd > field do i get the correct answer : > > Ticket Opened : Sunday, July 13th 2003 13:37 > Problem Start : Saturday, July 12th 2003 20:36 date() expects a UNIX timestamp to be passed to it. MySQL does not store dates as a UNIX timestamp in DATE, DATETIME, or TIMESTAMP columns. strtotime() will take a MySQL timestamp, though, and convert it to a UNIX timestamp. Also look into using DATE_FORMAT() in your query to format the data there so you don't have to do anything in PHP. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php