无法使用strtotime在PHP 4中分析ISO 8601日期


Unable to parse ISO 8601 dates in PHP 4 using strtotime

我正试图使用strtotime函数在PHP 4中解析以下ISO 8601日期:

2012-02-01T00:00:00.000Z

但是,返回-1。如何解决这个问题?我能做些什么?

不幸的是,我一直在使用PHP 4.3.10,因此无法使用任何更新的函数来解析日期。

试试这个:

strtotime(str_replace('T', ' ', $date));

对我有用:

$iso = '2013-06-25T15:16:13.000Z';
$d = str_replace('T', ' ', $iso);
$d = substr($d, 0, 19);
$ts = strtotime($d);
$isIso =  (strlen($iso) == 24 && substr($iso, 10, 1) === "T" && substr($iso, 19, 1) === "." && substr($iso, 23, 1) === "Z");