To determine the starting and ending times of the day based on the current time
Get the time period of the day
$nowdate = Date ("Y-m-d", Time ());
$begintime = Strtotime ($nowdate); Start timestamp of the day
$endtime = $begintime + 60*60*24; End time stamp of the day
$map [' add_time '] = Array (Array (' Egt ', $begintime), array (' LT ', $endtime), ' and ');
Determine the starting and ending times for this month based on the current time
$nowmonth = date ("M", Time ()), // get current month /span>
if ($nowmonth = = ' | | $nowmonth = = ' | | $nowmonth = = ' | | | $nowmonth = = ' | | | $nowmonth = = ' 08 ' | | $nowmonth = = ' 10 ' | | $nowmonth = = ' + ') {
$nowdate = Date ("Y-m", Time ());
$mstarttime = Strtotime ($nowdate); Start timestamp for this month
$mendtime = $mstarttime + 31*60*60*24;
}else if ($nowmonth = = ' 02 ') {
$nowdate = Date ("Y-m", Time ());
$mstarttime = Strtotime ($nowdate); Start timestamp of the month
$mendtime = $mstarttime + 28*60*60*24;
}else if ($nowmonth = = ' | | $nowmonth = = ' | | $nowmonth = = ' * ' | | $nowmonth = = ' 11 ') {
$nowdate = Date ("Y-m", Time ());
$mstarttime = Strtotime ($nowdate); Start timestamp of the month
$mendtime = $mstarttime + 30*60*60*24; End time of the month
}
$map [' add_time '] = Array (Array (' Egt ', $mstarttime), array (' LT ', $mendtime), ' and ');
PHP timestamp some examples