PHP strptime() Function
Example
Parse a time/date generated with strftime():
<?php
$format="%d/%m/%Y %H:%M:%S";
$strf=strftime($format);
echo("$strf");
print_r(strptime($strf,$format));
?>
Definition and Usage
The strptime() function parses a time/date generated with strftime().
Note: This function was deprecated in PHP 8.1.0.
Note: This function is not implemented on Windows platforms!
Syntax
strptime(date, format)
Parameter Values
| Parameter | Description |
|---|---|
| date | Required. The string to parse (e.g. returned from strftime()) |
| format | Required. Specifies the format used in the date:
|
Technical Details
| Return Value: | This function returns an array with the date parsed on success. FALSE on failure.
The meaning of the returning array keys are:
|
|---|---|
| PHP Version: | 5.1+ |
❮ PHP Date/Time Reference