I am trying to write code.
I could print like that Mongolian time 2019-09-27T15:09:34.915812+08:00 How to print local time zone? Like that "UTC+8"
You could use
pytz library
from datetime import datetime, timedelta from pytz import timezone import pytz utc_8 = timezone("Singapore") utc_8.zone fmt = '%Y-%m-%d %H:%M:%S %Z%z' loc_dt = utc_8.localize(datetime(2019, 9, 27, 15, 9, 34)) print(loc_dt.strftime(fmt)) #2019-09-27 15:09:34 +08+0800
LocalTimezoneclass defined in thedatetime.tzinfo