From 8ea464ea87a4013ab9a370b180c60966759280a8 Mon Sep 17 00:00:00 2001 From: Z4kM4rm3l Date: Mon, 6 Jul 2026 10:01:42 -0400 Subject: [PATCH] [tool] date_to_timestamp (#130) --- tools/date_to_timestamp.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tools/date_to_timestamp.py 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()))