Created
November 30, 2019 18:14
-
-
Save ty-shaikh/08631baac422d5347f55078457a570bd to your computer and use it in GitHub Desktop.
Calculate the days between when an item is posted and when the script is run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_days(soup_obj): | |
"Convert to EST and return difference in days" | |
created_date = soup_obj['data-created-at'] | |
pst_date = parse(created_date, ignoretz=True) | |
est_date = pst_date + timedelta(hours=3) | |
now = datetime.now() | |
diff = abs((est_date-now).days) | |
return diff | |
days = get_days(first_card) | |
print(days) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment