Skip to content

Commit

Permalink
accept any iso date as input
Browse files Browse the repository at this point in the history
  • Loading branch information
SidestreamColdMelon committed Dec 6, 2023
1 parent 489508a commit f44738b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
parsed=parser.parse_args()

# Cleanup positional arguments
date = parsed.date.replace("date=", "").replace(" UTC", "")
date = parsed.date.replace("date=", "").upper().replace(" UTC", "")
stamp = parsed.stamp.replace("stamp=", "")

# Convert provided input in UTC format into desired output in UTC as well
if date:
utc_date = datetime.strptime(date, DATE_FORMAT).replace(tzinfo=timezone.utc)
utc_date = datetime.fromisoformat(date).replace(tzinfo=timezone.utc)
print(utc_date)
print(int(utc_date.timestamp()))
if stamp:
Expand Down

0 comments on commit f44738b

Please sign in to comment.