note 109929 added to function.strtotime
| From: | meatwillmorgandotcodotyoukay | Date: | Mon, 03 Sep 2012 17:01:41 +0000 |
| Subject: | note 109929 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190461@lists.php.net to get a copy of this message | ||
For negative UNIX timestamps, strtotime seems to return the literal you passed in, or it may try to
deduct the number of seconds from today's date.
To work around this behaviour, it appears that the same behaviour as described in the DateTime
classes applies:
http://php.net/manual/en/datetime.construct.php
Specifically this line here (in the EN manual):
> The $timezone parameter and the current timezone are ignored when the $time parameter either is
> a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00).
Therefore strtotime('@-1000') returns 1000 seconds before the epoch.
Hope this helps.
----
Server IP: 94.76.225.145
Probable Submitter: 87.194.120.136
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/109929
Del: integrated -- https://master.php.net/note/delete/109929/integrated
Del: useless -- https://master.php.net/note/delete/109929/useless
Del: bad code -- https://master.php.net/note/delete/109929/bad+code
Del: spam -- https://master.php.net/note/delete/109929/spam
Del: non-english -- https://master.php.net/note/delete/109929/non-english
Del: in docs -- https://master.php.net/note/delete/109929/in+docs
Del: other reasons-- https://master.php.net/note/delete/109929
Reject -- https://master.php.net/note/reject/109929
Search -- https://master.php.net/manage/user-notes.php