PHP mktime() Function

PHP mktime Function


Definition :

In php microtime() Function is inbuilt function.PHP mktime() function is used to return the Unix timestamp for a given input date. It returns a long integer containing the number of seconds between the Unix Epoch and the time given. It accepts seven parameters $hour, $minute, $second, $month, $day, $year and $is_dst. It returns an integer Unix timestamp as output on success and False in the case of error.

Syntax

   mktime(hour, minute, second, month, day, year, is_dst)

Parameter 
Parameter Description
hour           Optional. Specifies the hour
minute           Optional. Specifies the minute
second           Optional. Specifies the second
month           Optional. Specifies the month
day           Optional. Specifies the day
year           Optional. Specifies the year
is_dst Optional. Set this parameter to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown. If it's unknown, PHP tries to find out itself (which may cause unexpected results). Note: This parameter is removed in PHP 7.0. The new timezone handling features should be used instead

Given below example return the Unix timestamp for a date. Then use it to find the day of that date:

Output : 

Apr 4, 1982 was on a Sunday

Jan-05-2002
Aug-03-2002
Mar-03-2001
Feb-02-1999