Sort by

recency

|

385 Discussions

|

  • + 0 comments
    format = '%a %d %b %Y %H:%M:%S %z'
        t1_str = datetime.datetime.strptime(t1, format)
        t2_str = datetime.datetime.strptime(t2, format)
        diff = t1_str - t2_str
        seconds = abs(int(diff.total_seconds()))
        
        return str(seconds)
    
  • + 0 comments

    t1 = datetime.strptime(t1, "%a %d %b %Y %H:%M:%S %z") t2 = datetime.strptime(t2, "%a %d %b %Y %H:%M:%S %z")

    if(t1>t2):
        x = abs((t1 - t2).seconds)
        y = abs((t1 - t2).days)
    else:
        x = abs((t2 - t1).seconds)
        y = abs((t2 - t1).days)
    
    return str(y*3600*24 + x)
    
  • + 0 comments
    from datetime import datetime
    
    for _ in range( int(input()) ):
        first_date = datetime.strptime(input(), "%a %d %b %Y %H:%M:%S %z")
        last_date = datetime.strptime(input(), "%a %d %b %Y %H:%M:%S %z")
        print(abs(int((first_date - last_date).total_seconds())))
    
  • + 0 comments

    def time_delta(t1, t2): struct_times = [datetime.datetime.strptime(_, "%a %d %b %Y %H:%M:%S %z") for _ in [t1, t2]]

    return "%d" % (abs(struct_times[0].timestamp() - struct_times[1].timestamp()))
    
  • + 0 comments

    Dealing with time zone differences can be confusing—just like scheduling with Movers and Packers Sharjah when you're shifting across cities!