Example
$t = time ();
Start time stamp
$start = Mktime (0,0,0,date ("M", $t), date ("D", $t), date ("Y", $t));
End time stamp
$end = Mktime (23,59,59,date ("M", $t), date ("D", $t), date ("Y", $t));
The definition and specific usage of the Mktime function record
Grammar
Mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST)
example today, yesterday, last week, this month's start time stamp and end time stamp
Start time cut
$start =mktime (0,0,0,date ("M"), Date ("D"), Date ("Y"));
End time Truncation:
$end =mktime (0,0,0,date (' m '), date (' d ') +1,date (' Y '))-1;
PHP gets yesterday's start timestamp and end time stamp
$beginYesterday =mktime (0,0,0,date (' m '), date (' d ') -1,date (' Y '));
$endYesterday =mktime (0,0,0,date (' m '), date (' d '), date (' Y '))-1;
PHP gets last week's start time stamp and end timestamp
$beginLastweek =mktime (0,0,0,date (' m '), date (' d ')-date (' W ') +1-7,date (' Y '));
$endLastweek =mktime (23,59,59,date (' m '), date (' d ')-date (' W ') +7-7,date (' Y '));
PHP gets this month's start timestamp and end time stamp
$beginThismonth =mktime (0,0,0,date (' m '), 1,date (' Y '));
$endThismonth =mktime (23,59,59,date (' m '), date (' t '), date (' Y '));
Definitions and usage
The Mktime () function returns a Unix timestamp for a date.
The parameter always represents the GMT date, so IS_DST has no effect on the result.
The parameters can be left-to-right, and the empty arguments will be set to the appropriate current GMT value.