博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PHP获取当日或本月时间戳范围
阅读量:4608 次
发布时间:2019-06-09

本文共 333 字,大约阅读时间需要 1 分钟。

在mysql数据库中使用int类型保存时间戳时,一般在程序中可能会用到统计当日,当月的一些数据。那么可以用如下的方式限定时间范围:
 
//当日销售
$today_start = strtotime(date('Y-m-d 00:00:00'));
$today_end = strtotime(date('Y-m-d 23:59:59'));
 
//本月销售
$month_start = strtotime(date("Y-m-01"));
$month_end = strtotime("+1 month -1 seconds", $month_start);

转载于:https://www.cnblogs.com/iverson-3/p/9973316.html

你可能感兴趣的文章