【发布时间】:2009-09-20 20:15:02
【问题描述】:
如何写“+3 days at 12:34:56”才能让 strtotime() 正确解析?
【问题讨论】:
-
在我的示例中,我希望今天的时间戳为 12:34:56 加上三天。
标签: php string parsing format strtotime
如何写“+3 days at 12:34:56”才能让 strtotime() 正确解析?
【问题讨论】:
标签: php string parsing format strtotime
$ts = strtotime("12:34:56 +3 days");
echo date('Y-m-d H:i:s O', $ts);
打印
2009-09-23 12:34:56 +0200
(我的本地时区是 CEST/gmt+2)
【讨论】:
哦,我明白了:我只需要删除“at”: “+3 天 12:34:56”解析,耶!
【讨论】:
我个人会做这样的事情:
date("Y-m-d 12:34:56",time()+(60*60*24*3))
【讨论】: