How to use mktime in PHP

This article describe about mktime() Function in PHP.
  • 2215

mktime() Function

This function return the Unix timestamps for date.

Syntax

mktime(hour, minute, second, month, day, year, is_dst)

 

Parameter Description
hour Optional. define the hour
minute Optional. define the minute
second Optional. define the second.
month Optional. define the month.
day Optional. define the day.
year Optional. define the year in validation range 1901 to 2038.
is_dst Optional. parameter is 1 if time is daylight saving time, 0 if not or -1 if it is unknown.

Example

<html>
<body>
<?php
echo(date("M-d-Y",mktime(0,0,0,12,36,2012))."<br />");
echo(date("M-d-Y",mktime(0,0,0,14,1,2012))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,1,2012))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,1,2000))."<br />");
?>
</body>
</html>

 

Output

pic9.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

© 2019 DotNetHeaven. All rights reserved.