PHP date_parse_from_format() Function

What is a Date Parse From Format Function?

Explanation

The "date_parse_from_format()" function is used get the detailed information for a given date.

Syntax:


array date_parse_from_format (string $format, string $date)

In the above syntax "format" is the required output format, "date" is the date for which detailed information is needed.

Example :


<?php
$date = "6.1.2009 13:00+01:00";
print_r(date_parse_from_format("j.n.Y H:iP", $date));
?>
Result :

Array
(
[year] => 2009
[month] => 1
[day] => 6
[hour] => 13
[minute] => 0
[second] => 0
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 1
[zone] => -60
[is_dst] =>
)

In the above example the date_parse_from_format() function will display all the details, for the specified date "6.1.2009" in a detailed format.

Note :

(PHP 5 >= 5.3.0)

PHP Topics


Ask Questions

Ask Question