From 1b2117089d49f72cb3020a106e6df38fe4047875 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 13 Nov 2022 18:58:37 -0800 Subject: [PATCH] Add timetools.fromtimestamp, fromtimestamp_local. --- voussoirkit/timetools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/voussoirkit/timetools.py b/voussoirkit/timetools.py index a0c9bef..42abb5b 100644 --- a/voussoirkit/timetools.py +++ b/voussoirkit/timetools.py @@ -5,3 +5,9 @@ def now(): def now_local(): return datetime.datetime.now().astimezone() + +def fromtimestamp(unix): + return datetime.datetime.utcfromtimestamp(unix).replace(tzinfo=datetime.timezone.utc) + +def fromtimestamp_local(unix): + return datetime.datetime.fromtimestamp(unix).astimezone()