始终坚信
好记性不如赖笔头!

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

赞(0)
本站未标注原创文章均为转载,如有侵权请告知!二宝博客 » php整理常用时间戳和日期

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址