time conversion
flupke
flupke at nonexistingdomain.com
Thu Oct 27 11:31:25 EDT 2005
Fredrik Lundh wrote:
> "flupke" wrote:
>
>
>>Is there an easy to convert following hour notation hh:mm
>>to decimals?
>>For instance 2 hours and 30 minutes as 2:30 to 2,50
>>I don't really know where to search for this kind of conversion.
>
>
> you mean like
>
> >>> timestamp = "2:30"
> >>> hour, minute = timestamp.split(":")
> >>> print int(hour) + int(minute) / 60.0
> 2.5
>
> ?
>
> </F>
>
>
>
yep, your sollution is shorter so i'll use that :)
Thanks
Benedict
More information about the Python-list
mailing list