Edit report at https://bugs.php.net/bug.php?id=62927&edit=1
ID: 62927 Updated by: ahar...@php.net Reported by: dan at chirica dot net Summary: date function peculiar return for 11/04/2012 -Status: Open +Status: Feedback Type: Bug Package: Date/time related Operating System: Ubuntu 10.4 PHP Version: 5.3.2 Block user comment: N Private report: N New Comment: What time zone do you have set? Previous Comments: ------------------------------------------------------------------------ [2012-08-27 20:58:29] dan at chirica dot net $ 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) ------------------------------------------------------------------------ [2012-08-26 18:19:03] andreas at heigl dot org 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 ------------------------------------------------------------------------ [2012-08-24 18:33:29] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62927&edit=1