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

81 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST 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