Yep, I was using the DATE() function in PHP to convert a TIMESTAMP from a MySQL DB 
query. I was getting a year of 2038 because MySQL and PHP use different TIMESTAMP 
formats.

There are several FUNCTIONS that convert the two TIMESTAMPS from one to the other, 
(see comments in PHP manuals) but I wound up using the call from a mySQL query to 
convert the data.

much like this....
// GET CONVERTED MYSQL TIME TO UNIX TIME
        $getmyTime = mysql_query("SELECT UNIX_TIMESTAMP(timestamp_col) AS yournamehere 
FROM myDBnamehere WHERE id = $whatever")
         or die("Invalid query");
         $mysqlTime = mysql_result($getmyTime, 0, 0);
// TURN TIME INTO VIEWABLE STRING
         $myTime = date("F j, Y  @ h:i A", $mysqlTime)." EST";

This spits back "July 1, 2002 @ 04:41 PM EST" instead of some year in 2038 when I did 
the same thing without the SELECT UNIX_TIMESTAMP query.

Thanks again for all your replies.
PHP RULES! (insert white boy dance here)
- NorthBayShane


-----Original Message-----
From: Shane 
Sent: Monday, July 01, 2002 9:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP] mySQL time = year 2038 [HELP] 


Checked the archive and saw no difinitives... so... How come when I query my clients 
mySQL DB and use NULL or NOW() as my default in a TIMESTAMP record that it always 
comes up Jan 18, 2038?

Is the clock not set properly, or am I misunderstanding some basic principal of the 
time stamp?

My clients version pf PHP is 4+ on a Windows IIS server.

Any clues???
Thanks
-NorthBayShane

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


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

Reply via email to