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

php時間戳轉換的示例

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

復制代碼 代碼如下:
<?php

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

?>

php技術php時間戳轉換的示例,轉載需保留來源!

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

主站蜘蛛池模板: 嫩江县| 邢台县| 灵寿县| 青州市| 新巴尔虎左旗| 白山市| 博乐市| 玛沁县| 富锦市| 三穗县| 昌图县| 连云港市| 盐城市| 临沭县| 永修县| 巴塘县| 永修县| 剑河县| 乌兰浩特市| 繁峙县| 盱眙县| 湖北省| 麻阳| 财经| 泊头市| 青浦区| 永嘉县| 休宁县| 邯郸市| 科技| 错那县| 中方县| 柘荣县| 利辛县| 保定市| 浦东新区| 邯郸市| 新乡县| 沾益县| 普陀区| 仪陇县|