The following examples draw the result:
Copy CodeThe code is 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 the Code code as follows:
Yesterday, today and tomorrow's date conversion
($startstr start timestamp 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 a day
Tomorrow
$tomorrow _s = $startstr + $oneday _count; Start from tomorrow
$tomorrow _e = $tomorrow _s + $oneday _count-1; Tomorrow is over.
Yesterday
$yesterday _s = $startstr-$oneday _count; Started yesterday
$yesterday _e = $startstr-1; Ended yesterday
Ends today
$today _e = $tomorrow _s-1;
Yesterday, today and tomorrow 0 points and the same day 23 points 59 minutes 59 seconds Combined Array
$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 ());
Timestamp converted to "start"
$btimestr = Strtotime ($btime);
Var_dump (Alldaytostr ($BTIMESTR));
?>
http://www.bkjia.com/PHPjc/747676.html www.bkjia.com true http://www.bkjia.com/PHPjc/747676.html techarticle The following example shows the result: the copy code code is as follows: Array (3) {["Yesterday"]= Array (2) {[0]= int (1395874800) [1]= Int (1395961199)} ["Today"]= array (2) {[0]= int (1395961200) [...]