1. 二宝博客首页
  2. php

php整理常用时间戳和日期

昨天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"));
]]>

原创文章,作者:键盘游走者,如若转载,请注明出处:https://www.708034.com/2015/07/php%e6%95%b4%e7%90%86%e5%b8%b8%e7%94%a8%e6%97%b6%e9%97%b4%e6%88%b3%e5%92%8c%e6%97%a5%e6%9c%9f/

发表评论

电子邮件地址不会被公开。 必填项已用*标注