|
date_parse_from_formatGet info about given date formatted according to the specified format Description
array date_parse_from_format(string
$format , string $datetime )Returns associative array with detailed info about given date/time. Parameters
Return ValuesReturns associative array with detailed info about given date/time.
The returned array has keys for
If
The array includes
The array also contains Warning
The number of array elements in the Errors/Exceptions
This functions throws ValueError when the
Changelog
Examples
Example #1 date_parse_from_format example
The above example will output: 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] => 3600 [is_dst] => )
Example #2 date_parse_from_format with warnings example
The above example will output: Warnings count: 1 On position 23: The parsed time was invalid
Example #3 date_parse_from_format with errors example
The above example will output: Errors count: 3 On position 15: A two digit hour could not be found On position 19: Data missing See Also
|