Skip to content

Use UTC dates #1362

@Lonami

Description

@Lonami

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions