>>> now = datetime.datetime.now(pytz.timezone('Asia/Tokyo'))
>>> dt = datetime(now.year, now.month, now.day, now.hour, now.minute, now.second, now.microsecond, pytz.timezone('Asia/Tokyo'))
>>> now
datetime.datetime(2018, 9, 7, 16, 9, 24, 177751, tzinfo=<DstTzInfo 'Asia/Tokyo' JST+9:00:00 STD>)
>>> dt = datetime(now.year, now.month, now.day, now.hour, now.minute, now.second, now.microsecond, pytz.timezone('Asia/Tokyo'))
>>> dt
datetime.datetime(2018, 9, 7, 16, 9, 24, 177751, tzinfo=<DstTzInfo 'Asia/Tokyo' LMT+9:19:00 STD>)
For now
I got JST+9:00:00 and for dt
I got LMT+9:19:00. I don't understand why datetime
uses a different format.
When I compare the times they are different:
>>> now == dt
False
How can I convert LMT
to JST
so that now == dt
is True
? I need to use datetime(2018, 9, 7, 16, 9, 24, 177751, timezone('Asia/Tokyo'))
and at the same time I want JST
.