码迷,mamicode.com
首页 > Web开发 > 详细

PHP常用时间戳获取 昨天,明天,上周,本月

时间:2016-08-03 15:16:54      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:


//昨天0时时间戳
$yesterday_zero = strtotime(date(‘Y-m-d‘)) - 3600 * 24;
//昨天此时时间戳
$yesterday_now = strtotime(‘-1 day‘);
//本周一时间戳
$week_this_monday = strtotime(‘last Monday‘);
//明天时间戳
$tomorrow = strtotime("+1 day");
//上周一时间戳
$week_last_monday = strtotime(‘last Monday‘) - 3600 * 24 * 7;
//上周日时间戳
$week_last_sunday = strtotime(‘last Monday‘) - 3600 * 24;
//本月第一天时间戳
$month_first = strtotime(date("Y") . "-" . date("m") . "-1");
//本月最后一天时间戳
$month_last = strtotime(date("Y") . "-" . date("m") . "-" . date("t"));
//获取上个月第一天及最后一天
echo date(‘Y-m-01‘, strtotime(‘-1 month‘));
echo "<br/>";
echo date(‘Y-m-t‘, strtotime(‘-1 month‘));

 

PHP常用时间戳获取 昨天,明天,上周,本月

标签:

原文地址:http://www.cnblogs.com/jason-encode/p/5732681.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!