PHP strtotime() function

PHP strptime() function
PHP time() function

What is the syntax of the strtotime() function in PHP?

strtotime(time, now);
ParameterDescription
timeRequired. Specifies a date/time string
nowOptional. Specifies the timestamp used as a base for the calculation of relative dates

Examples of the strtotime() function

Example 1. In this example,

<?php
echo(strtotime("now") . "<br>");
echo(strtotime("3 October 2005") . "<br>");
echo(strtotime("+5 hours") . "<br>");
echo(strtotime("+1 week") . "<br>");
echo(strtotime("+1 week 3 days 7 hours 5 seconds") . "<br>");
echo(strtotime("next Monday") . "<br>");
echo(strtotime("last Sunday"));
?>
PHP strptime() function
PHP time() function
en English
X
Scroll to Top