We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Date and Time
- Time Delta
- Discussions
Time Delta
Time Delta
Sort by
recency
|
373 Discussions
|
Please Login in order to post a comment
Here's my code:
!/bin/python3
import math import os import random import re import sys from datetime import datetime
Complete the time_delta function below.
def time_delta(t1, t2): dt1, dt2 = [datetime.strptime(x, '%a %d %b %Y %H:%M:%S %z') for x in [t1, t2]] return str(abs(int((dt1 - dt2).total_seconds())))
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
absolute difference (in seconds) between them.