Python time differences

后端 未结 4 2099
忘掉有多难
忘掉有多难 2020-12-17 09:07

I have two time objects.

Example

time.struct_time(tm_year=2010, tm_mon=9, tm_mday=24, tm_hour=19, tm_min=13, tm_sec=37, tm_wday=4, tm_yday=267, tm_is         


        
4条回答
  •  我在风中等你
    2020-12-17 09:57

    You can use time.mktime(t) with the struct_time object (passed as "t") to convert it to a "seconds since epoch" floating point value. Then you can subtract those to get difference in seconds, and divide by 60 to get difference in minutes.

提交回复
热议问题