PHP mktime Function: Get Unix Timestamp
The PHP mktime() function is used to obtain the Unix timestamp of a specified date. The Unix timestamp is an integer value that represents the number of seconds from the Unix epoch (January 1, 1970 00:00:00 GMT) to the specified date. The syntax of the mktime() function is as follows:
mktime(hour, minute, second, month, day, year)
Explanation of parameters:
- hour: hour
- minute: a unit of time equal to sixty seconds
- second: the unit of time equal to 1/60th of a minute
- month: a period of time lasting approximately four weeks in the calendar, corresponding to the lunar cycle
- day: day
- year: year
These parameters are optional. If no parameters are provided, the function will return the Unix timestamp of the current date. The mktime() function can be used to create a Unix timestamp for a specified date, such as by specifying the year, month, day, hour, minute, and second to obtain the Unix timestamp for a specific date.