note 117402 added to function.time
| From: | PeterF | Date: | Thu, 04 Jun 2015 12:59:01 +0000 |
| Subject: | note 117402 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202744@lists.php.net to get a copy of this message | ||
Javier:
The issue are highlighting is with the date() function, not with time(). the following code
demonstrates this:
<?php
// server in BST Timezone
print 'server timezone<br>';
$time1 = date('H:i:s', time() - date('Z')); // 12:50:29
$time2 = date('H:i:s', gmdate('U')); // 13:50:29
$time3 = date('H:i:s', time()); // 13:50:29
$time4 = time() - date('Z'); // 1433418629
$time5 = gmdate('U'); // 1433422229
$time6 = time(); // 1433422229
print $time1.'<br>';
print $time2.'<br>';
print $time3.'<br>';
print $time4.'<br>';
print $time5.'<br>';
print $time6.'<br>';
ini_set('date.timezone', 'Europe/Berlin');
print 'Europe/Berlin<br>';
$time1 = date('H:i:s', time() - date('Z')); // 12:50:29
$time2 = date('H:i:s', gmdate('U')); // 14:50:29
$time3 = date('H:i:s', time()); // 14:50:29
$time4 = time() - date('Z'); // 1433415029
$time5 = gmdate('U'); // 1433422229
$time6 = time(); // 1433422229
print $time1.'<br>';
print $time2.'<br>';
print $time3.'<br>';
print $time4.'<br>';
print $time5.'<br>';
print $time6.'<br>';
ini_set('date.timezone', 'UTC');
print 'UTC<br>';
$time1 = date('H:i:s', time() - date('Z')); // 12:50:29
$time2 = date('H:i:s', gmdate('U')); // 12:50:29
$time3 = date('H:i:s', time()); // 12:50:29
$time4 = time() - date('Z'); // 1433422229
$time5 = gmdate('U'); // 1433422229
$time6 = time(); // 1433422229
print $time1.'<br>';
print $time2.'<br>';
print $time3.'<br>';
print $time4.'<br>';
print $time5.'<br>';
print $time6.'<br>';
?>
----
Server IP: 72.52.91.14
Probable Submitter: 80.254.147.164 (proxied: 62.73.169.152)
----
Manual Page -- http://php.net/manual/en/function.time.php
Edit -- https://master.php.net/note/edit/117402
Del: integrated -- https://master.php.net/note/delete/117402/integrated
Del: useless -- https://master.php.net/note/delete/117402/useless
Del: bad code -- https://master.php.net/note/delete/117402/bad+code
Del: spam -- https://master.php.net/note/delete/117402/spam
Del: non-english -- https://master.php.net/note/delete/117402/non-english
Del: in docs -- https://master.php.net/note/delete/117402/in+docs
Del: other reasons-- https://master.php.net/note/delete/117402
Reject -- https://master.php.net/note/reject/117402
Search -- https://master.php.net/manage/user-notes.php