|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-01-21 08:04 UTC] ricky at ez2 dot us
Description:
------------
strftime with %s format returns wrong value.
Test script:
---------------
<?php
//php.ini date.timezone = Asia/Taipei (UTC +0800)
date_default_timezone_set('UTC');
$time = time();
$time2 = strftime('%s', $time);
if($time != $time2){
echo "something wrong";
}
else{
echo "nothing";
}
Expected result:
----------------
nothing
Actual result:
--------------
something wrong
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 06:00:01 2025 UTC |
I can not reproduce this with PHP 5.5.21: derick@whisky:~ $ cat /tmp/68871.php <?php date_default_timezone_set('UTC'); $time = time(); $time2 = strftime('%s', $time); var_dump( $time, $time2 ); ?> derick@whisky:~ $ php -ddate.timezone=Asia/Taipei /tmp/68871.php int(1421841507) string(10) "1421841507" What do you see different here?