note 24340 added to function.strtotime
| From: | jbetz at removethis dot pocketinet dot com | Date: | Tue, 13 Aug 2002 17:49:09 +0000 |
| Subject: | note 24340 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34946@lists.php.net to get a copy of this message | ||
For ISO8601 dates I use:
function toUnixTime($string)
{
list($year,$month,$day,$hour,$minute,$second)
= split("[-:T\.]",$string);
// TODO: if(($year < 100) and (strlen($year) == 4))
// then I shouldn't get the current century.
// Don't know how to pass this to strtotime.
return strtotime("$year-$month-$day $hour:$minute:$second");
}
This works for recent dates, but not those before year 0100 (see above TODO). Also this
doesn't consider the timezones..
--
http://www.php.net/manual/en/function.strtotime.php
http://master.php.net/manage/user-notes.php?action=edit+24340
http://master.php.net/manage/user-notes.php?action=delete+24340
http://master.php.net/manage/user-notes.php?action=reject+24340