色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php時間戳轉(zhuǎn)換的示例

以下例子得出結(jié)果:
復(fù)制代碼 代碼如下:
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(1396133999) } }

復(fù)制代碼 代碼如下:
<?php

//昨天,今天和明天的日期轉(zhuǎn)換   
//($startstr 今天開始時間戳)
//返回(昨天,今天和明天)的0點(diǎn)和23點(diǎn)59分59秒
function alldaytostr($startstr) {
 $oneday_count = 3600 * 24;  //一天有多少秒
 //明天
 $tomorrow_s = $startstr + $oneday_count;    //明天開始
 $tomorrow_e = $tomorrow_s + $oneday_count - 1;  //明天結(jié)束
 //昨天
 $yesterday_s = $startstr - $oneday_count;  //昨天開始
 $yesterday_e = $startstr - 1;   //昨天結(jié)束
 //今天結(jié)束
 $today_e = $tomorrow_s - 1;
 //昨天、今天和明天 0點(diǎn)和當(dāng)天23點(diǎn)59分59秒合并成數(shù)組
 $allday_array = array('yesterday' => array($yesterday_s, $yesterday_e),
  'today' => array($startstr, $today_e),
  'tomorrow' => array($tomorrow_s, $tomorrow_e));
 return $allday_array;
}
//當(dāng)天開始時間
$btime = date('Y-m-d'.'00:00:00',time());
//轉(zhuǎn)換成“開始”的時間戳
$btimestr = strtotime($btime);
var_dump(alldaytostr($btimestr));

?>

php技術(shù)php時間戳轉(zhuǎn)換的示例,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 斗六市| 彭州市| 乾安县| 青浦区| 安吉县| 奉化市| 海城市| 察哈| 洪湖市| 丰台区| 繁昌县| 禹城市| 九江市| 翼城县| 谢通门县| 千阳县| 青河县| 子长县| 台前县| 银川市| 驻马店市| 汤阴县| 筠连县| 乳山市| 凭祥市| 昌吉市| 太谷县| 香河县| 泗洪县| 新泰市| 东海县| 静安区| 松江区| 彭州市| 河南省| 灵台县| 宜兴市| 黎川县| 无极县| 邛崃市| 桂东县|