Add timetools.fromtimestamp, fromtimestamp_local.

This commit is contained in:
voussoir 2022-11-13 18:58:37 -08:00
parent 8185da9add
commit 1b2117089d

View file

@ -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()