|
def from_timestamp(unixtime): |
|
""" |
|
Args: |
|
unixtime (int): |
|
|
|
Returns: |
|
datetime.datetime: |
|
|
|
""" |
|
if not unixtime: |
|
return None |
|
|
|
return datetime.fromtimestamp(unixtime) |
Should probably be using tz=timezone.utc. Python's datetime isn't the best, and fromtimestamp by default sets no tz information, which uses the local time, which in turn is generally a bad idea.
python-telegram-bot/telegram/utils/helpers.py
Lines 78 to 90 in 4397903
Should probably be using
tz=timezone.utc. Python'sdatetimeisn't the best, andfromtimestampby default sets notzinformation, which uses the local time, which in turn is generally a bad idea.