note 3480 modified in Date and Time functions by ronabop

From: Date: Sat, 26 Aug 2000 04:47:36 +0000
Subject: note 3480 modified in Date and Time functions by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-3293@lists.php.net to get a copy of this message
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. http://www.php.net/manual/date-and-time-functions.php

« previous php.notes (#3293) next »