If you want to have total difference in seconds then you can use: echo $difference_in_seconds = strtotime(' 11:55:06') - strtotime(' 03:55:06') //28800Äepends upon your need and the final format in which you want to have time difference. For example if you only are interested in hour difference and you know that difference cant be more than 24 hours then use only %H. Output: The difference in minutes is: 21 minutes We can also find the time difference in minutes using the following method.You can remove any of above values as per your need. You can setup difference format as per your needs. diff($datetime2) Ä®cho $interval->format('%Y years %m months %d days %H hours %i minutes %s seconds') //00 years 0 months 0 days 08 hours 0 minutes 0 seconds This article demonstrates how to get the time difference between two dates in minutes in PHP. Use OOP method for date time difference: $datetime1 = new DateTime(' 03:55:06') //start time
0 Comments
Leave a Reply. |