python time to utc code example
Example 1: python datetime to utc
from datetime import timezone
timestamp = dt.replace(tzinfo=timezone.utc).timestamp()
Example 2: python datetime from timestamp utc
dt_object = datetime.fromtimestamp(timestamp)
from datetime import timezone
timestamp = dt.replace(tzinfo=timezone.utc).timestamp()
dt_object = datetime.fromtimestamp(timestamp)