简体   繁体   English

这里有一个有趣的问题 - 为什么明天日期 PHP 和 +1 天给出不同的时间

[英]Interesting Question here - Why Tomorrow Date PHP and +1 Days Gives Different Time

Hello PHP DEV, I Want to know why this strange thing is happening: Example: strtotime("+1 days") returns time as UTC TIME which is current Time so why strtotime('tomorrow') returns time as 00:00.00.您好 PHP DEV,我想知道为什么会发生这种奇怪的事情:示例:strtotime("+1 days") 将时间返回为 UTC 时间,即当前时间,那么为什么 strtotime('tomorrow') 将时间返回为 00:00.00。

I noticed this show wants to know the official reason behind this.我注意到这个节目想知道这背后的官方原因。

strtotime("+1 days") uses current time and adds a day strtotime("+1 days")使用当前时间并增加一天

strtotime('tomorrow') returns tomorrow at midnight (this is stated in the docs) strtotime('tomorrow')明天午夜返回(这在文档中说明)

datetime formats 日期时间格式

'yesterday' Midnight of yesterday "yesterday 14:00" 'midnight' The time is set to 00:00:00 'yesterday' 昨天的午夜 "yesterday 14:00" 'midnight' 时间设置为 00:00:00
'today' The time is set to 00:00:00 '今天' 时间设置为 00:00:00
'now' Now - this is simply ignored 'now' Now - 这被简单地忽略了
'noon' The time is set to 12:00:00 "yesterday noon" 'tomorrow' Midnight of tomorrow 'noon' 时间设置为 12:00:00 "yesterday noon" 'tomorrow' 明天午夜

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

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