note 3480 deleted from ref.datetime by vincent
| From: | vincent@php.net | Date: | Thu, 11 Sep 2003 11:50:23 +0000 |
| Subject: | note 3480 deleted from ref.datetime by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56070@lists.php.net to get a copy of this message | ||
Note Submitter: liv@nospam.duke.edu
----
If you need to convert a string to a timestamp, versions 3.0.12 and up include strtotime($AString)
which uses a yacc-generated parser to generate a timestamp from your user input. It assumes that
times are broken up by ":", and that dates use the "/" delimiter and are entered
in American (MM/DD/YY) format. am/pm and 24 hour formats are accepted for times.
If the string passed to the function only indicates the time (for example, 12:00am) the timestamp
that is generated will contain that time, on the day that the timestamp was generated.
Dates without a time are assumed to be 12:00am. There may be odd behavior related to time-zones, as
under certain circumstances the creation of the date and the printing of the date may each assume
that the date is in UTC, causing a double correction.
One other thing about strtotime- if your entry is invalid, it'll return -1 to indicate failure.