strptime function parses a time/date generated with strftime(). This function returns an array with the date parsed. The meaning of the returning array keys are:
tm_sec - seconds (0-61)
tm_min - minutes (0-59)
tm_hour - hour (0-23)
tm_mday - day of the month (1-31)
tm_mon - months since January (0-11)
tm_year - years since 1900
tm_wday - days since Sunday (0-6)
tm_yday - days since January 1 (0-365)
unparsed - the date part which was not recognized using the specified format, if any
Syntax of strptime() Function in PHP
strptime (date, format)
strptime() returns an array with the date parsed, or returns FALSE on error. Month and weekday names and other language dependent strings respect the current locale set with setlocale() (LC_TIME).
Parameters for strptime() Function in PHP
date - This is required string parameter to parse.
format (string) - Also essential, it specifies the format used in date as it is used in strftime().
$format = '%d/%m/%Y %H:%M:%S';
$strf = strftime($format);
The above example will output something similar to:
[tm_sec] => 49
[tm_min] => 27
[tm_hour] => 13
[tm_mday] => 3
[tm_mon] => 8
[tm_year] => 109
[tm_wday] => 6
[tm_yday] => 240
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.