RE: [PHP] mySQL time = year 2038 [SOLVED]

From: Date: Mon, 01 Jul 2002 22:25:52 +0000
Subject: RE: [PHP] mySQL time = year 2038 [SOLVED]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-104793@lists.php.net to get a copy of this message
> 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. > $getmyTime = mysql_query("SELECT UNIX_TIMESTAMP(timestamp_col) AS yournamehere FROM > myDBnamehere WHERE id = $whatever") > or die("Invalid query"); If you mainly need to output a date in a particular format you might find it more effective to use mysql's date formatting capabilities. Have a look in the manual for the section on DATE_FORMAT() which will let you get the date out of your table in just about any format you desire. CYA, Dave

« previous php.general (#104793) next »