首页
it技术
登录
6mi
u
盘
搜
搜 索
it技术
PHP中计算某时间周六日的方法
PHP中计算某时间周六日的方法
it
2024-05-13
46
需求
统计报表中的每周第一天,其实是从周日0点0分0秒到下一次周六的23:59:59。
示例
比如现在时间是2020/10/21,需要计算本周六的日期。代码如下:
$now
=
time
(
)
;
$start
=
date
(
'Y/m/d 00:00:00'
,
strtotime
(
"Saturday -
{
$i
}
week"
,
$now
)
-
86400
*
6
)
;
// $now 时间的周六时间
$end
=
date
(
'Y/m/d 23:59:29'
,
strtotime
(
"Saturday -
{
$i
}
week"
,
$now
)
)
;
//$now 时间所在州的最后一天
转载请注明原文地址: https://lol.8miu.com/read-16358.html
最新回复
(
0
)