PHP: mktime() function
Description
The mktime() function returns the Unix timestamp for a date.
Version:
(PHP 4 and above)
Syntax:
mktime(hour, minute, second, month, day, year, is_dst)
Parameter:
Name | Description | Required/ Optional |
Type |
---|---|---|---|
hour | Numeric representation of hours | Optional | Integer |
minute | Numeric representation of minute | Optional | Integer |
second | Numeric representation of second | Optional | Integer |
month | Numeric representation of month | Optional | Integer |
day | Numeric representation of day | Optional | Integer |
year | Numeric representation of year | Optional | Integer |
is_dst | Whether Daylight Saving Time is active (values 1 or 0 ). In PHP 5.1.0, this parameter became deprecated. As a result, the new timezone handling features should be used instead. | Optional | Integer |
Return value:
The Unix timestamp corresponding to the parameters given. If the parameters are invalid, the function returns FALSE.
Value Type: Integer.
Example:
<?php
echo(date("M-d-Y",mktime(0,0,0,2,12,98))."<br />");
echo(date("M-d-Y",mktime(0,0,0,17,4,2005))."<br />");
echo(date("M-d-Y",mktime(0,0,0,1,36,2000))."<br />");
echo(date("M-d-Y",mktime(24,0,0,1,1,99))."<br />");
?>
Sample Output :
Feb-12-1998 May-04-2006 Feb-05-2000 Jan-02-1999
View the example in the browser
See also
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics