Yasen Sayed
Published in : 2022-02-25
Hello guys, anyone can help me to get the difference between the two times in PHP for example:
"from" => "12:00:00" "to" => "20:00:00"
I want the difference between these times in hours.
Thanks.
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now
Rakshit Date : 2022-02-25
Best answers
34
Best answers
34
If you are using 24 hours format you don't need AM or PM annotations at all.
By default 00:00:00 means 12:00 AM of the day.
In the given example, from timestamp shows time = 12:00:00, it means 12 hours passed, so your time is - 12:00 PM of the day.
To timestamp shows 20:00:00, it means 8:00 PM of the respective day. Max time can be 23:59:59, and after that it will be turned to 00:00:00 (12:00 AM)
You can add number of hours in 12:00:00 PM to count further all hours in 24 hours format if you see the time > 12:00:00.
Shilpa Date : 2022-02-26
Best answers
10
Best answers
10
It shows you are using 24 hours format.
From date shows 12 O'clock of Afternoon
To date shows 8 O'clock of evening!