It is always a best practice to store dates in UTC. Do not ever store dates in your local timezone in which you will go to hell in your programming experience!
Given that you have saved your dates in UTC and would like to convert them into
#python #date #utc #strftime #dateutil #timezone #pytz
Given that you have saved your dates in UTC and would like to convert them into
Asia/Tehran
date in Python
do like below:date_format = '%Y-%m-%d %H:%M:%S'
local_tz = pytz.timezone('Asia/Tehran')
submit_time = dateutil.parser.parse(utc_date)
submit_time = submit_time.replace(tzinfo=pytz.utc).astimezone(local_tz)
output = submit_time.strftime(date_format)
#python #date #utc #strftime #dateutil #timezone #pytz