繁体   English   中英

如何用PHP计算下周一的日期?

[英]How to calculate the date of next Monday in PHP?

我正在尝试获取下一个星期一晚上00:01的约会。 我正在使用以下几行:

date('Y-m-d h:i:s', strtotime(**'next monday, 01:01am'**, strtotime(date("Y-m-d h:i:s"))))

这给了我正确的输出:

2014-05-19 01:01:00

但是,如果我尝试写:

date('Y-m-d h:i:s', strtotime(**'next monday, 00:01am'**, strtotime(date("Y-m-d h:i:s"))))

我越来越:

1970-01-01 05:30:00

请告诉我这里有什么问题。

00:01 am 不正确使用12:01 am

尝试这个:

date('Y-m-d h:i:s', strtotime('next monday, 12:01am', strtotime(date("Y-m-d h:i:s"))));

它会给你2014-05-19 12:01:00

演示

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM