You are viewing a single comment's thread. Return to all comments →
my code!!
from datetime import datetime
def time_delta(t1, t2): format_str = "%a %d %b %Y %H:%M:%S %z" datetime1 = datetime.strptime(t1, format_str) datetime2 = datetime.strptime(t2, format_str) delta = abs((datetime1 - datetime2).total_seconds()) return str(int(delta))
if name == "main": t = int(input()) for _ in range(t): t1 = input().strip() t2 = input().strip() print(time_delta(t1, t2))
Seems like cookies are disabled on this browser, please enable them to open this website
Time Delta
You are viewing a single comment's thread. Return to all comments →
my code!!
from datetime import datetime
def time_delta(t1, t2): format_str = "%a %d %b %Y %H:%M:%S %z" datetime1 = datetime.strptime(t1, format_str) datetime2 = datetime.strptime(t2, format_str) delta = abs((datetime1 - datetime2).total_seconds()) return str(int(delta))
if name == "main": t = int(input()) for _ in range(t): t1 = input().strip() t2 = input().strip() print(time_delta(t1, t2))