Definition and usage
The Mktime () function returns a Unix timestamp for a date.
The parameter always represents the GMT date, so IS_DST has no effect on the result.
Parameters can be left-to-right and empty, and empty parameters will be set to the corresponding current GMT value.
Grammar
Mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST)
Parameter description
| Hour |
Optional. Specified hours. |
| Minute |
Optional. Specify minutes. |
| Second |
Optional. Specify seconds. |
| Month |
Optional. Specifies the number of months to be represented. |
| Day |
Optional. Prescribed days. |
| Year |
Optional. Prescribed year. On some systems, the legal value is between 1901-2038. However, there is no such limit in PHP 5. |
| Is_dst |
Optional. If the time is in daylight saving time (DST), set to 1, otherwise set to 0 and if unknown, set to-1. Since 5.1.0, the IS_DST parameter has been discarded. Therefore, you should use the new Time zone processing feature. |
Hints and Notes
Note: Before PHP 5.1, if the parameter of the function is illegal, it will return false.
Example
The Mktime () function is useful for date arithmetic and validation. It can automatically correct out-of-bounds input:
Output:
jan-05-2002feb-01-2002jan-01-2001jan-01-1999