|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-08-24 18:33 UTC] dan at chirica dot net
Description: ------------ --- From manual page: http://www.php.net/function.date#refsect1-function.date- returnvalues --- Test script: --------------- $date1 = 1352012400; //$date2 = $date1 + 86400 which should be next day $date2 = 1352098801; echo "date1: " . date ("Y-m-d_h:i:s", $date1) . "\n"; echo "date2: " . date ("Y-m-d_h:i:s", $date2) . "\n"; //Output //date1: 2012-11-04_12:00:00 //date2: 2012-11-04_11:00:01 Expected result: ---------------- date1: 2012-11-04_12:00:00 date2: 2012-11-05_12:00:00 Actual result: -------------- //Output //date1: 2012-11-04_12:00:00 //date2: 2012-11-04_11:00:01 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 12:00:01 2025 UTC |
I can NOT reproduce the issue on MacOS X 10.7 Here is the output of my console $ php -v PHP 5.3.16 (cli) (built: Aug 17 2012 11:13:15) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans $ cat /tmp/datetest.php <?php $date1 = 1352012400; //$date2 = $date1 + 86400 which should be next day $date2 = 1352098801; echo "date1: " . date ("Y-m-d_h:i:s", $date1) . "\n"; echo "date2: " . date ("Y-m-d_h:i:s", $date2) . "\n"; $ php -f /tmp/datetest.php date1: 2012-11-04_08:00:00 date2: 2012-11-05_08:00:01$ php -v PHP 5.3.2-1ubuntu4.17 with Suhosin-Patch (cli) (built: Jun 19 2012 03:21:35) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH $ cat date.php <?php $date1 = 1352012400; //$date2 = $date1 + 86400 which should be next day $date2 = 1352098801; echo "date1: " . date ("Y-m-d_h:i:s", $date1) . "\n"; echo "date2: " . date ("Y-m-d_h:i:s", $date2) . "\n"; //Output //date1: 2012-11-04_12:00:00 //date2: 2012-11-04_11:00:01 ?> $php date.php date1: 2012-11-04_12:00:00 date2: 2012-11-04_11:00:01 Similar behavior on Mac OS 10.8 with PHP PHP (MAMP) 5.3.2 (cli) (built: Mar 5 2010 16:45:34)