How to use strtotime in PHP

This article describe about strtotime() Function in PHP.
  • 1710

strtotime() Function

Parsed English textual date/time into the Unix timestamp by using the strtotime() function.

Syntax

strtotime(time, now)

 

Parameter Description
time Required. Define the time string for parse.
now Optional. Timestamp used to calculate the returned value. If omitted current date time used.

Example

<html>
<body>
<?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"));
?>
</body>
</html>

 

Output


pic12.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.