diff --git a/tools/date_to_timestamp.py b/tools/date_to_timestamp.py new file mode 100644 index 0000000..577519c --- /dev/null +++ b/tools/date_to_timestamp.py @@ -0,0 +1,7 @@ +from datetime import datetime, timezone + + +def run(date_str: str) -> str: + """Converts a date string (YYYY-MM-DD) to a Unix timestamp.""" + dt = datetime.strptime(date_str, "%Y-%m-%d").replace(tzinfo=timezone.utc) + return str(int(dt.timestamp()))