The following example shows the result:
Copy Code code as follows:
Array (3) {[' Yesterday ']=> Array (2) {[0]=> int (1395874800) [1]=> int (1395961199)} [' Today ']=> Array (2) {[0] => Int (1395961200) [1]=> int (1396047599)} ["Tomorrow"]=> Array (2) {[0]=> int (1396047600) [1]=> Int (13961 33999)}}
Copy Code code as follows:
<?php
Yesterday, today and tomorrow's date conversion
($startstr start time stamp today)
Return (Yesterday, today and tomorrow) 0 points and 23 points 59 minutes 59 seconds
function Alldaytostr ($STARTSTR) {
$oneday _count = 3600 * 24; How many seconds in a day
Tomorrow
$tomorrow _s = $startstr + $oneday _count; Start from tomorrow
$tomorrow _e = $tomorrow _s + $oneday _count-1; It ends tomorrow.
Yesterday
$yesterday _s = $startstr-$oneday _count; Started yesterday
$yesterday _e = $startstr-1; Ended yesterday
It's over today.
$today _e = $tomorrow _s-1;
Yesterday, today and tomorrow 0 and 23, 59 minutes, 59 seconds, combine the groups.
$allday _array = Array (' Yesterday ' => array ($yesterday _s, $yesterday _e),
' Today ' => Array ($startstr, $today _e),
' Tomorrow ' => Array ($tomorrow _s, $tomorrow _e));
return $allday _array;
}
Day start time
$btime = Date (' y-m-d '. ') 00:00:00 ', Time ());
Time stamp converted to start
$btimestr = Strtotime ($btime);
Var_dump (Alldaytostr ($BTIMESTR));
?>