fuseau horaire Python DateTime
import datetime
import pytz
my_date = datetime.datetime.now(pytz.timezone('US/Pacific'))
Panicky Pigeon
import datetime
import pytz
my_date = datetime.datetime.now(pytz.timezone('US/Pacific'))
import datetime
import pytz
d = datetime.datetime.now()
timezone = pytz.timezone("America/Los_Angeles")
# List of Time Zones: https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568
d_aware = timezone.localize(d)
d_aware.tzinfo
# One Liner
timezone.localize(datetime.datetime.now())
# Timestamp to Datetime with timezone
datetime.fromtimestamp(3456789, timezone)
my_date = datetime.datetime.now(pytz.timezone('US/Pacific'))
from datetime import timezone
ts = now.strftime("%Y-%m-%d %H:%M:%S%z")
datetime_with_timezone = datetime.datetime(2019, 2, 3, 6, 30, 15, 0, pytz.UTC)