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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx] 
Sent: Sunday, April 22, 2007 2:05 AM
To: PHP-General
Cc: John Taylor-Johnston
Subject:  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

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux