RE: [PHP] echo date('Y-m-d', $mydata->timestamp);

From: Date: Mon, 23 Apr 2007 00:54:37 +0000
Subject: RE: [PHP] echo date('Y-m-d', $mydata->timestamp);
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253504@lists.php.net to get a copy of this message
You are misunderstanding what timestamp means. The value of a timestamp is from UNIX epoch http://en.wikipedia.org/wiki/Unix_time. It is calculated by the number of seconds after January 1st, 1970. Also note, that you are overflowing the integer, which is giving you a http://en.wikipedia.org/wiki/Year_2038_problem Y2K38 problem. If you want the UNIX timestamp of 4/19/2007 16:21:23, you can do mktime(16,21,23,4,19,2007); (http://us.php.net/manual/en/function.mktime.php). -Logan -----Original Message----- From: John Taylor-Johnston [mailto:John.Taylor-Johnston@cegepsherbrooke.qc.ca] Sent: Sunday, April 22, 2007 2:05 AM To: PHP-General Cc: John Taylor-Johnston Subject: [PHP] echo date('Y-m-d', $mydata->timestamp); $mydata->timestamp = "20070419162123"; echo date('Y-m-d', $mydata->timestamp); result: 2038-01-18 ?? What is wrong?? Should be 2007-04-19? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#253504) next »