note 128750 added to datetime.formats
| From: | JulianEgelstaff at main dot php dot net | Date: | Wed, 19 Jul 2023 19:03:39 +0000 |
| Subject: | note 128750 added to datetime.formats | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220710@lists.php.net to get a copy of this message | ||
For the DateTime class, you can use a numeric timestamp with an @ prepended. ie: @1689770881
Note that it will be created assuming the current timezone PHP is using. You can't specify a
timezone param in this case. See date_default_timezone_get and date_default_timezone_set for more
about the current timezone.
You can use the setTimezone method after creation to set a timezone. Note that this will change the
hours reported by the DateTime object if you do something like echo
$dateTime->format('H') because the time of day will have shifted with the timezone,
even though the moment in time is the same as the original timestamp.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.168 (proxied: 174.93.75.146)
----
Manual Page -- https://php.net/manual/en/datetime.formats.php
Edit -- https://main.php.net/note/edit/128750
Del: integrated -- https://main.php.net/note/delete/128750/integrated
Del: useless -- https://main.php.net/note/delete/128750/useless
Del: bad code -- https://main.php.net/note/delete/128750/bad+code
Del: spam -- https://main.php.net/note/delete/128750/spam
Del: non-english -- https://main.php.net/note/delete/128750/non-english
Del: in docs -- https://main.php.net/note/delete/128750/in+docs
Del: other reasons-- https://main.php.net/note/delete/128750
Reject -- https://main.php.net/note/reject/128750
Search -- https://main.php.net/manage/user-notes.php