0

I have a simple problem to convert any kind of date time string into INDIAN date time string or you can say convert to Indian timezone but unable to find an exact approach

1 Answers1

0

so here is the exact answer

import pytz
from dateutil import parser

IST = pytz.timezone('Asia/Kolkata')
tzdate = parser.parse('2019-04-21T10:38:16.000Z')
print(tzdate.astimezone(IST).isoformat())

In this first you are importing "pytz" which is python package for getting time zone of any country using string by which I am getting IST in 3rd line. After that, I parsed the date and time string in the fourth line. And after implementing all I assign IST as time zone during printing date and time.