Skip to content
Advertisement

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.

I noticed this show wants to know the official reason behind this.

Advertisement

Answer

strtotime(“+1 days”) uses current time and adds a day

strtotime(‘tomorrow’) returns tomorrow at midnight (this is stated in the docs)

datetime formats

‘yesterday’ Midnight of yesterday “yesterday 14:00” ‘midnight’ The time is set to 00:00:00
‘today’ The time is set to 00:00:00
‘now’ Now – this is simply ignored
‘noon’ The time is set to 12:00:00 “yesterday noon” ‘tomorrow’ Midnight of tomorrow

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement