扫码一下
查看教程更方便
根据指定的格式返回一个包含指定日期信息的关联数组:
<?php
print_r(date_parse_from_format("mmddyyyy","05122013"));
echo "<br><br>";
print_r(date_parse_from_format("j.n.Y H:iP","12.5.2013 14:35+02:00"));
?>
?>
执行结果
Array
(
[year] =>
[month] => 12
[day] => 13
[hour] =>
[minute] =>
[second] =>
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 1
[errors] => Array
(
[8] => Data missing
)
[is_localtime] =>
)
<br><br>Array
(
[year] => 2013
[month] => 5
[day] => 12
[hour] => 14
[minute] => 35
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 1
[zone] => 7200
[is_dst] =>
)
?>
date_parse_from_format() 函数根据指定的格式返回一个包含指定日期信息的关联数组。
date_parse_from_format(format,date);
参数 | 描述 |
---|---|
format | 必需。规定格式(格式由 date_create_from_format() 接受)。 |
date | 必需。一个指定日期的字符串。 |