Home >Backend Development >PHP Tutorial >php mktime calculates the difference between two times_PHP tutorial
mktime = mktime($hours,minute,seconds,month,day,years)
$start_time = mktime(0,0,0,01,09,2010); //Start time
$end_time = mktime(0,0,0,02,09,2010); //End time
$times = $end_time-$start_time; //
How many seconds 6 is the difference between the start and the end?
$now_time = $times/(24*3600); //Get how many there are in total
The mktime() function returns the unix timestamp of a date.
The argument always represents a gmt date, so is_dst has no effect on the result.
The parameters can be left empty in order from right to left, and the 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 is optional. Specified minutes.
second is optional. Specifies seconds.
month is optional. Specifies the numeric month.
day is optional. Specify days.
year is optional. Specified year. On some systems, legal values are between 1901 - 2038. However, this limitation no longer exists in PHP Tutorial 5.
is_dst Optional. Set to 1 if the time is during daylight saving time (dst), 0 otherwise, or -1 if unknown.
As of 5.1.0, the is_dst parameter is deprecated. Therefore the new time zone handling features should be used.