The time() function is used to get the current time as a Unix timestamp (the number of seconds since the beginning of the Unix epoch: January 1 1970 00:00:00 GMT).
We can convert this timestamp to a human readable date through passing it to the previously introduce date() function.
The PHP mktime() Function:
The mktime() function is used to create the timestamp based on a specific date and time. If no date and time is provided, the timestamp for the current date and time is returned.
The syntax of the maktime() function can be given with:
mktime(hour, minute, second, month, day, year)
The following example displays the timestamp corresponding to 4:40:12 pm on September 21, 2016:
The maktime() function can be used to find the weekday name corresponding to a particular date. To do this, simply use the ‘l’ (lowercase ‘L’) character with your timestamp, as in the following example, which displays the day that falls on September 21, 2016:
The mktime() function can also be used to find a particular date in future after a specific time period. As in the following example, which displays the date which falls on after 30 month from the current date?