Created
June 1, 2024 12:53
-
-
Save ichux/44cd1ae3dc0e5b210b61a73f59fc7644 to your computer and use it in GitHub Desktop.
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
from datetime import datetime | |
import pytz | |
data = { | |
"sub": [ | |
["a1", "2024-07-01 07:39:41 UTC+0000"], | |
["a3", "2024-07-01 07:39:41 UTC+0000"], | |
["j5", "2024-07-01 07:39:41 UTC+0000"], | |
] | |
} | |
valid = [] | |
current_time = datetime.now(pytz.UTC) | |
for username, date in data["sub"]: | |
representation = datetime.strptime(date, "%Y-%m-%d %H:%M:%S %Z%z") | |
if current_time <= representation.astimezone(pytz.UTC): | |
valid.append(username) | |
print(valid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment