In [1]:
import datetime
In [2]:
s = '2018/12/31 05:00:30+0900'
In [3]:
dt = datetime.datetime.strptime(s, '%Y/%m/%d %H:%M:%S%z')
In [4]:
print(dt)
In [5]:
print(dt.tzinfo)
In [6]:
s = '2018-12-31T05:00:30+09:00'
In [7]:
dt = datetime.datetime.fromisoformat(s)
In [8]:
print(dt)
In [9]:
print(dt.tzinfo)