Add timetools.fromtimestamp, fromtimestamp_local.
This commit is contained in:
parent
8185da9add
commit
1b2117089d
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue