note 24340 deleted from function.strtotime by sniper
| From: | sniper@php.net | Date: | Tue, 21 Oct 2003 11:03:11 +0000 |
| Subject: | note 24340 deleted from function.strtotime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59018@lists.php.net to get a copy of this message | ||
Note Submitter: jbetz@removethis.pocketinet.com
----
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..