Current IST (Asia/Kolkata) is 5:23 PM and UTC is 11:53 AM same day. I wanted to convert IST to UTC. I tried following:
from dateutil import tz
from datetime import datetime
from_zone = tz.gettz('IST') # also tried tz.gettz('Asia/Kolkata')
to_zone = tz.gettz('UTC')
t = '2023-06-04 05:23'
t = datetime.strptime(t, '%Y-%m-%d %H:%M')
t = t.replace(tzinfo=from_zone)
t = t.astimezone(to_zone)
print(t.strftime('%Y-%m-%d %H:%M'))
Above still prints '2023-06-04 05:23'
. That is no time zone change happened. Why is this so?