Doc #77840 [NEW]: strftime("%s") returns false results

From: Date: Wed, 03 Apr 2019 18:44:34 +0000
Subject: Doc #77840 [NEW]: strftime("%s") returns false results
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16544@lists.php.net to get a copy of this message
From: dc at ftb-esv dot de Operating system: PHP version: Irrelevant Package: *General Issues Bug Type: Documentation Problem Bug description:strftime("%s") returns false results Description: ------------ --- From manual page: https://php.net/function.strftime --- Functions strftime() and gmstrftime() return (different) wrong results for format "%s". I tested it with PHP 5.5.14 and PHP 7.2.5, bith with CLI and Apache. I used timestamps with and without DST. Test script: --------------- <?PHP header('Content-Type: text/plain; charset=utf-8'); $list = array( 1546303600, // 2018-01-01 00:46:40 UTC 1556703600, // 2019-05-01 09:40:00 UTC ); echo "\ndate_default_timezone_set('UTC')\n"; date_default_timezone_set('UTC'); foreach ( $list as $time ) { printf("\n%u\n%4s\n%s\n", $time, strftime('%s, %F %T %Z',$time), gmstrftime('%s, %F %T %Z',$time) ); } echo "\ndate_default_timezone_set('Europe/Berlin')\n"; date_default_timezone_set('Europe/Berlin'); foreach ( $list as $time ) { printf("\n%u\n%4s\n%s\n", $time, strftime('%s, %F %T %Z',$time), gmstrftime('%s, %F %T %Z',$time) ); } ?> Expected result: ---------------- date_default_timezone_set('UTC') 1546303600 1546303600, 2019-01-01 00:46:40 UTC 1546303600, 2019-01-01 00:46:40 GMT 1556703600 1556703600, 2019-05-01 09:40:00 UTC 1556703600, 2019-05-01 09:40:00 GMT date_default_timezone_set('Europe/Berlin') 1546303600 1546303600, 2019-01-01 01:46:40 CET 1546303600, 2019-01-01 00:46:40 GMT 1556703600 1556703600, 2019-05-01 11:40:00 CEST 1556703600, 2019-05-01 09:40:00 GMT Actual result: -------------- date_default_timezone_set('UTC') 1546303600 1546300000, 2019-01-01 00:46:40 UTC 1546300000, 2019-01-01 00:46:40 GMT 1556703600 1556700000, 2019-05-01 09:40:00 UTC 1556700000, 2019-05-01 09:40:00 GMT date_default_timezone_set('Europe/Berlin') 1546303600 1546303600, 2019-01-01 01:46:40 CET 1546300000, 2019-01-01 00:46:40 GMT 1556703600 1556703600, 2019-05-01 11:40:00 CEST 1556700000, 2019-05-01 09:40:00 GMT -- Edit bug report at https://bugs.php.net/bug.php?id=77840&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77840&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77840&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77840&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77840&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77840&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77840&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77840&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77840&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77840&r=support Expected behavior: https://bugs.php.net/fix.php?id=77840&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77840&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77840&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77840&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77840&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77840&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77840&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77840&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77840&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77840&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77840&r=mysqlcfg

« previous php.doc.bugs (#16544) next »