View Single Post

  #2 (permalink)  
Old 03-23-2007
iktorn
 
Posts: n/a
Default Re: How to calculate the running time

Krustov napisał(a):
> The start and end times for a tv show or film .
> 17:50
> 18:30
>
> 40 minutes running time
>
> 23:50
> 00:30
>
> 40 minutes running time
>
> 23:50
> 01:40
>
> 110 minutes running time
>
>
> While i could write the code in a luddite type of fashion and it would
> work fine and stuff - is there a one or two line solution that would do
> the same job ? .


echo (strtotime("18:30")-strtotime("17:50"))/60;
echo (strtotime("+1 days 1:40")-strtotime("23:50"))/60;
at least I don't know any better solution :)

--
Wiktor Walc
http://phpfreelancer.net
Reply With Quote