PHP strtotime() Function is used to convert an English textual datetime into a Unix timestamp. A strtotime() function is PHP built-in function.
PHP Version : PHP 4, PHP 5, PHP 7, PHP 8
Syntax for strtotime:
strtotime(string $datetime, int|null $now= null);
Parameter,
$datetime : Required. It is a date/time string.
$now : Optional. The timestamp which is used as a base for the calculation of relative dates.
Return values for strtotime:
PHP strtotime() Function returns a timestamp on success
otherwise it returns false on failure.
Errors/Exceptions:
It will generate a E_NOTICE if the time zone is not valid.
Let's see below example to understand php strtotime() Function in details.
Comments