PHP Function gmmktime
PHP is a programming language that has many functions built into it to make coding easier. Functions are short code snippets that do a specific task.
PHP function gmmktime is used to generate the number of seconds measured since the GMT epoch for a date and time. The gmmktime() function takes 6 parameters representing the year, month, day, hour, minute and second of the date and time that you want to create a Unix timestamp for.
The year parameter can be an integer value between 1 and 32767. The month and day values must be in the range of 1 to 31. The gmmktime() function also allows you to use a negative day value (ie -1) for the last day of the given month.
The is_dst parameter specifies whether or not the passed date and time should be adjusted for daylight saving time. It is not required as the other parameters always represent a GMT date and time, so it does not influence the final result of the gmmktime() function.
The gmmktime() function returns the Unix timestamp on success or false on error. Unlike the date() function which returns a date relative to PHP’s local timezone, gmmktime() return the GMT epoch timestamp on success. PHP also has other function that can convert a date into a time stamp, such as the strtotime() function. This function takes inputs of the hour, day, month and year and returns an ISO 8601 timestamp. It accepts values between Friday, 13 December 1901 and Tuesday, 19 January 2038. However it will not work with dates before the Unix epoch. This is because negative dates are not supported by Windows, and some other systems, so they will not be parsed correctly.