Python Convert to date and compare
Question: I have two strings like 1352789792.757637 and 1352789919.235815. How to
convert them back to time and compare?

Thanks for help


Answer: This is assuming that those seconds are seconds since the epoch. If so, this
should work for converting to a `struct_time`:

    
    
    >>> import time
    >>> time.gmtime(1352789792.757637)
    time.struct_time(tm_year=2012, tm_mon=11, tm_mday=13, tm_hour=6, tm_min=56, tm_sec=32, tm_wday=1, tm_yday=318, tm_isdst=0)
    

However note that the format you got back from the file actually represents
seconds, so manipulations like differences, etc. can all be done on those
numbers. Depending on what kind of analysis you want to do, that may make it a
bit easier (i.e. treat them as `floats` instead of converting to time). Not
sure of your use case though, so this may be misguided :)

