这可能无法完全回答您的问题,但需要检查
date_parse()
"Double timezone specification"
,如果出现错误
DateTime
无法创建。
date_parse("1920-09-12d")
Array
(
[year] => 1920
[month] => 9
[day] => 12
[hour] =>
[minute] =>
[second] =>
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 2
[zone] => -240
[is_dst] =>
[tz_abbr] => D
)
注意时区“D”
date_parse("1920-09n-12")
Array
(
[year] => 1920
[month] => 9
[day] => 1
[hour] =>
[minute] =>
[second] =>
[fraction] =>
[warning_count] => 1
[warnings] => Array
(
[8] => Double timezone specification
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 2
[zone] => 60
[is_dst] =>
[tz_abbr] => N
)
date_parse("1920r-09-12")
Array
(
[year] =>
[month] =>
[day] =>
[hour] => 19
[minute] => 20
[second] => 0
[fraction] =>
[warning_count] => 1
[warnings] => Array
(
[5] => Double timezone specification
)
[error_count] => 1
[errors] => Array
(
[8] => Double timezone specification
)
[is_localtime] => 1
[zone_type] => 2
[zone] => 300
[is_dst] =>
[tz_abbr] => R
)
注意时区“R”,而且没有解析日期,而是
1920
被解释为时间
19:20:00