note 127131 added to datetime.gettimestamp
| From: | mike.eastghost.com via php-notes | Date: | Wed, 25 May 2022 07:10:47 +0000 |
| Subject: | note 127131 added to datetime.gettimestamp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218523@lists.php.net to get a copy of this message | ||
Not clearly noted in documentation:
UNIX timestamps are by definition in UTC timezone only: @1234567890 represents the same date/time
regardless of timezone.
Therefore, DateTime::getTimestamp() always returns (seconds since epoch) in the UTC timezone, even
when DateTime object has its DateTimeZone set to any non-UTC timezone.
To make a 'timestamp' that is local to your server (in any non-UTC timezone), use mktime()
and feed it the desired/offset local time components.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.12.131 (proxied: 138.88.64.2)
----
Manual Page -- https://php.net/manual/en/datetime.gettimestamp.php
Edit -- https://main.php.net/note/edit/127131
Del: integrated -- https://main.php.net/note/delete/127131/integrated
Del: useless -- https://main.php.net/note/delete/127131/useless
Del: bad code -- https://main.php.net/note/delete/127131/bad+code
Del: spam -- https://main.php.net/note/delete/127131/spam
Del: non-english -- https://main.php.net/note/delete/127131/non-english
Del: in docs -- https://main.php.net/note/delete/127131/in+docs
Del: other reasons-- https://main.php.net/note/delete/127131
Reject -- https://main.php.net/note/reject/127131
Search -- https://main.php.net/manage/user-notes.php