8 lines
247 B
Python
8 lines
247 B
Python
from datetime import datetime
|
|
from zoneinfo import ZoneInfo
|
|
|
|
|
|
# TODO Add documentation
|
|
def get_unix_timestamp(date: datetime, to_utc: bool = False) -> int:
|
|
return int((date if not to_utc else date.replace(tzinfo=ZoneInfo("UTC"))).timestamp())
|