In [1]:
import datetime
import pytz

In [2]:
jst = pytz.timezone('Asia/Tokyo')

In [3]:
print(jst)


Asia/Tokyo

In [4]:
eastern = pytz.timezone('US/Eastern')

In [5]:
print(eastern)


US/Eastern

In [6]:
print(type(jst))


<class 'pytz.tzfile.Asia/Tokyo'>

In [7]:
print(issubclass(type(jst), datetime.tzinfo))


True

In [8]:
dt_aware = datetime.datetime(2018, 12, 31, 5, 0, 30, 1000,
                             tzinfo=datetime.timezone.utc)

In [9]:
print(dt_aware)


2018-12-31 05:00:30.001000+00:00

In [10]:
print(dt_aware.astimezone(jst))


2018-12-31 14:00:30.001000+09:00

In [11]:
print(dt_aware.astimezone(eastern))


2018-12-31 00:00:30.001000-05:00

In [12]:
print(dt_aware.replace(tzinfo=jst))


2018-12-31 05:00:30.001000+09:19

In [13]:
print(dt_aware.replace(tzinfo=eastern))


2018-12-31 05:00:30.001000-04:56

In [14]:
print(jst.localize(dt_aware.replace(tzinfo=None)))


2018-12-31 05:00:30.001000+09:00

In [15]:
print(eastern.localize(dt_aware.replace(tzinfo=None)))


2018-12-31 05:00:30.001000-05:00

In [16]:
dt_naive = datetime.datetime(2018, 12, 31, 5, 0, 30, 1000)

In [17]:
print(dt_naive)


2018-12-31 05:00:30.001000

In [18]:
print(dt_naive.replace(tzinfo=jst))


2018-12-31 05:00:30.001000+09:19

In [19]:
print(dt_naive.replace(tzinfo=eastern))


2018-12-31 05:00:30.001000-04:56

In [20]:
print(jst.localize(dt_naive))


2018-12-31 05:00:30.001000+09:00

In [21]:
print(eastern.localize(dt_naive))


2018-12-31 05:00:30.001000-05:00

In [22]:
print(datetime.datetime(2018, 12, 31, 5, 0, 30, 1000,
                        tzinfo=jst))


2018-12-31 05:00:30.001000+09:19

In [23]:
print(jst.localize(datetime.datetime(2018, 12, 31, 5, 0, 30, 1000)))


2018-12-31 05:00:30.001000+09:00

In [24]:
print(datetime.datetime.now(jst))


2019-01-21 00:00:42.540529+09:00

In [25]:
dt_dst = datetime.datetime(2018, 3, 11, 2, 0, 0, 0)

In [26]:
print(eastern.localize(dt_dst))


2018-03-11 02:00:00-05:00

In [27]:
print(eastern.normalize(eastern.localize(dt_dst)))


2018-03-11 03:00:00-04:00