Python time differences

后端 未结 4 2094
忘掉有多难
忘掉有多难 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 10:03

    >>> t1 = time.mktime(time.strptime("10 Oct 10", "%d %b %y"))
    >>> t2 = time.mktime(time.strptime("15 Oct 10", "%d %b %y"))
    >>> print(datetime.timedelta(seconds=t2-t1))
    5 days, 0:00:00
    

提交回复
热议问题