strptime
strptime
Parse a time/date generated with strftime
**strptime** string $timestamp string $format
returns an array with the
parsed, or false on error.
`strptime``timestamp`
Month and weekday names and other language dependent strings respect the
current locale set with ().
`setlocale``LC_TIME`
timestamp``string
The string to parse (e.g. returned from ).
strftime
format``string
The format used in (e.g. the same as
used in ). Note that some of the format
options available to may not have any
effect within ; the exact subset that are
supported will vary based on the operating system and C library in
use.
timestamp``strftime``strftime``strptime
For more information about the format options, read the
page.
`strftime`
Returns an arrayreturn.falseforfailure.
Voorbeeld: example
<?php
$format = '%d/%m/%Y %H:%M:%S';
$strf = strftime($format);
echo "$strf\n";
print_r(strptime($strf, $format));
03/10/2004 15:54:19
Array
(
[tm_sec] => 19
[tm_min] => 54
[tm_hour] => 15
[tm_mday] => 3
[tm_mon] => 9
[tm_year] => 104
[tm_wday] => 0
[tm_yday] => 276
[unparsed] =>
)
Opmerking: > Internally, this function calls the function provided by the system's C library. This function can exhibit noticeably different behaviour across different operating systems. The use of , which does not suffer from these issues, is recommended.
strptime()``date_parse_from_format
Opmerking: > includes any leap seconds (currently upto 2 a year). For more information on leap seconds, see the .
"tm_sec"Wikipedia article on leap seconds
IntlDateFormatter::parse``DateTime::createFromFormat``checkdate``strftime``date_parse_from_format