添加2周(截至午夜)

Dia*_*nte 1 php datetime

我有$end = date('Y.m.d', strtotime("+2 weeks")); Log当前正好在触发后的2周内,但是如何让它在午夜结束?

例如:用户触发日志在下午1点32分,它在23:59:59 2周后结束?

时间以unixtime格式存储在数据库中

Rij*_*jin 5

$end = date('Y.m.d 23:59:59', strtotime("+2 weeks"));
Run Code Online (Sandbox Code Playgroud)


spl*_*h58 5

echo $end = date('r', strtotime("+2 weeks +1 day midnight -1 sec"));
//  Mon, 01 Aug 2016 23:59:59 +0000
Run Code Online (Sandbox Code Playgroud)