note 123401 added to function.date
| From: | mirco dot babin at gmail dot com | Date: | Thu, 06 Dec 2018 08:58:17 +0000 |
| Subject: | note 123401 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209854@lists.php.net to get a copy of this message | ||
One important thing you should remember is that the timestamp value returned by time() is time-zone
agnostic and gets the number of seconds since 1 January 1970 at 00:00:00 UTC. This means that at a
particular point in time, this function will return the same value in the US, Europe, India, Japan,
...
date() will format a time-zone agnostic timestamp according to the default timezone set with
date_default_timezone_set(...). Local time. If you want to output as UTC time use:
<?php
function dateUTC($format, $timestamp = null)
{
if ($timestamp === null) $timestamp = time();
$tz = date_default_timezone_get();
date_default_timezone_set('UTC');
$result = date($format, $timestamp);
date_default_timezone_set($tz);
return $result;
}
/>
----
Server IP: 208.43.231.9
Probable Submitter: 84.53.107.126
----
Manual Page -- http://php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/123401
Del: integrated -- https://master.php.net/note/delete/123401/integrated
Del: useless -- https://master.php.net/note/delete/123401/useless
Del: bad code -- https://master.php.net/note/delete/123401/bad+code
Del: spam -- https://master.php.net/note/delete/123401/spam
Del: non-english -- https://master.php.net/note/delete/123401/non-english
Del: in docs -- https://master.php.net/note/delete/123401/in+docs
Del: other reasons-- https://master.php.net/note/delete/123401
Reject -- https://master.php.net/note/reject/123401
Search -- https://master.php.net/manage/user-notes.php