time.timezone python code example
Example 1: datetime python timezone
import datetime
import pytz
my_date = datetime.datetime.now(pytz.timezone('US/Pacific'))
Example 2: python - oordinated universal time
from datetime import datetime, timezone
print(datetime.now())
print(datetime.now(timezone.utc))
Example 3: time module in python
import time
seconds = time.time()
print("Seconds since epoch =", seconds)
Example 4: python import timezone
from datetime import timezone
Example 5: python set timezone of datetime
datetime_with_timezone = datetime.datetime(2019, 2, 3, 6, 30, 15, 0, pytz.UTC)