Find time difference in minutes with php or mysql -


i have 2 data inputs can enter start time , finish time.

for example

start_time 13:00  finish_time 14:40 

the entry format of hh:mm.

i'd find time difference, in case 100 minutes.

what best way it?

you use diff within datetime.

#!/usr/bin/env php  <?php  $datetime1 = new datetime('13:00'); $datetime2 = new datetime('14:40');  $interval = $datetime1->diff($datetime2);  $hours   = $interval->format('%h'); $minutes = $interval->format('%i');  echo $hours * 60 + $minutes;  ?> 

Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -

openssl - Load PKCS#8 binary key into Ruby -