View Single Post

  #6 (permalink)  
Old 03-24-2007
Jerry Stuckle
 
Posts: n/a
Default Re: How to calculate the running time

iktorn wrote:
> 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 :)
>


Or to put everything in one statement, perhaps

echo ((strtotime("+1 days 1:40")-strtotime("23:50"))/60) % (24*60*60);

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote