Datetime 如何将mm dd yyyy hh:mm字符串转换为unix时间戳?

Datetime 如何将mm dd yyyy hh:mm字符串转换为unix时间戳?,datetime,Datetime,当我检查$new_str的值时,我得到 $time_str = '2013-09-03 03:29:11' ; preg_match('/([0-9]+)-([0-9]+)-([0-9]+) (.*)/', $time_str, $matches); $new_str = $matches[3] . '-' . $matches[1] . '-' . $matches[2] . ' ' . $matches[4]; 但是当我检查strotime$new_str的值时,我得到了$str的空值

当我检查$new_str的值时,我得到

$time_str = '2013-09-03 03:29:11' ;

preg_match('/([0-9]+)-([0-9]+)-([0-9]+) (.*)/', $time_str, $matches);
$new_str = $matches[3] . '-' . $matches[1] . '-' . $matches[2] . ' ' . $matches[4];
但是当我检查strotime$new_str的值时,我得到了$str的空值
其中$str=strotime$new_str

要将mm-dd-yyy-hh:mm字符串转换为unix时间戳,可以使用strotime


更多信息,这里的findout

是$new\u strcorrect的格式,如MM-YYYY-DD中的格式,它是否需要为strotime使用不同的格式?实际上,我得到了这个结果,因为输出应该使用一些date\u format函数来更改它,这可能会有帮助,因为编译器可能会与格式混淆,但我认为它会引发异常。看这里
$new_str = 03-2013-09 03:29:11