Yasen Sayed
25 Feb 2022
PHP & Mysql
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.
Rakshit
25 Feb 2022
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.
© 2024 Copyrights reserved for web-brackets.com