note 73122 added to function.strtotime
| From: | sean at awesomeplay dot com | Date: | Fri, 09 Feb 2007 20:29:00 +0000 |
| Subject: | note 73122 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123182@lists.php.net to get a copy of this message | ||
Regarding the "NET" thing, it's probably parsing it as a time-zone. If you give
strtotime any timezone string (like PST, EDT, etc.) it will return the time in that time-zone.
In any case, you shouldn't use strtotime to validate dates. It can and will give incorrect
results. As just one shining example:
Date: 05/01/2007
To most Americans, that's May 1st, 2007. To most Europeans, that's January 5th, 2007. A
site that needs to serve people around the globe cannot use strtotime to validate or even interpret
dates.
The only correct way to parse a date is to mandate a format and check for that specific format
(preg_match will make your life easy) or to use separate form fields for each component (which is
basically the same thing as mandating a format).
----
Server IP: 69.147.83.197
Probable Submitter: 71.238.87.27
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/73122
Del: integrated -- https://master.php.net/note/delete/73122/integrated
Del: useless -- https://master.php.net/note/delete/73122/useless
Del: bad code -- https://master.php.net/note/delete/73122/bad+code
Del: spam -- https://master.php.net/note/delete/73122/spam
Del: non-english -- https://master.php.net/note/delete/73122/non-english
Del: in docs -- https://master.php.net/note/delete/73122/in+docs
Del: other reasons-- https://master.php.net/note/delete/73122
Reject -- https://master.php.net/note/reject/73122
Search -- https://master.php.net/manage/user-notes.php