PHP date processing function mktime () tutorial
Definition and usage
The date of the Unix timestamp returned by the mktime () function.
This timestamp contains the Unix time between seconds (January 1, 1970 00:00:00 GMT), and at the specified time.
Syntax
Mktime (hour, minute, second, month, day, year, is_dst)
| Parameter |
Description |
| Hour |
Optional. Hour
|
| Minute |
(Optional) specify the minute |
| Second |
(Optional) specify the second. |
| Month |
(Optional) specify the numerical month. |
| Day |
(Optional) specify the day. |
| Year |
(Optional) specify the year. The valid range for year is on some systems between 1901 and 2038. However this limitation is overcome in PHP 5 |
| Is_dst |
Optional. Set this parameter to 1 if the time is in daylight saving time (DST), 0 if not, or-1 (default value) if it is unknown. If it is unknown, PHP tries to find itself (which may lead to unexpected results ). Note: this parameter is not recommended in PHP 5. Use the new processing function
|
Tips and instructions
Note: If the argument is invalid, the function returns false (-1 before PHP version 5.1 ).
--------------------------------------------------------------------------------
For example
The mktime () function is a useful date for arithmetic and verification. It will automatically calculate various inputs out of the correct value
<? Phpecho (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>");?>
Output code
Jan-05-2002Feb-01-2002Jan-01-2001Jan-01-1999