From:             jiri dot kapinus at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Date/time related
Bug Type:         Feature/Change Request
Bug description:Possible problems with the UNIX timestamp

Description:
------------
The UNIX timestamp gives the number of seconds since January 1 1970
00:00:00 UTC. 
But value of UNIX timestamp can be different, that in really is. More
information 
on http://www.najdouvas.cz/unix-timestamp-error/

Test script:
---------------
<?php
date_default_timezone_set('UTC');
echo "Current time and date in UTC timezone: " . date("M d Y H:i:s",
time()) . "<br>";
date_default_timezone_set('America/Kentucky/Monticello');
echo "Current time and date in America/Kentucky/Monticello timezone: " .
date("M d Y H:i:s", time()) . "<br>";
echo "UNIX timestamp defined by Strtotime for now: " . strtotime("now")  .
" <br>";
$start = strtotime("now");
$zonestart = date("M d Y H:i:s", 00);
echo "UNIX timestamp start at: Jan 01 1970 00:00:00 UTC<br>";
echo "when convert this time to America/Kentucky/Monticello, it returns
following date for Monticello timezone<br>";
echo "UNIX timestamp start at:   " . $zonestart . "
America/Kentucky/Monticello timezone<br>";
echo "To this date we add UNIX timestamp for NOW time. The result may be
the same as the current time and date for America/Kentucky/Monticello
<br>";
$date = date_create($zonestart);
$date->modify('+ ' . $start . ' sec');
echo "Result is: " . $date->format('M d Y H:i:s e') . "<br>";
date_default_timezone_set('UTC');
$date->setTimezone(new DateTimeZone("UTC")); 
echo "Changing this time to UTC timezone: " . $date->format('M d Y H:i:s
e') . "<br><br>";
echo "When final date is not the same as the date at the begining, it
means, that the UNIX timestamp don't give up exact number of second for
this place or timezone. The UNIX timestamp gives the number of seconds
since January 1 1970 00:00:00 UTC. But it's different for different
places.<br><br>";
?>


-- 
Edit bug report at https://bugs.php.net/bug.php?id=65608&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65608&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65608&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65608&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65608&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65608&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65608&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65608&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65608&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65608&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65608&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65608&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65608&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65608&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65608&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65608&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65608&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65608&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65608&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65608&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65608&r=mysqlcfg

Reply via email to