How to convert string with timezone to datetime in utc with python?

Viewed 9494

I am new Python. I am stuck at one point. I have variable that store time as string with specified timezone.

It is look like as given below

>>> print usertime
2017-08-18T08:00:00+04:30
>>> type(usertime)
<type 'str'>

So I just want to convert usertime time to utc time, The output should subtract 4 hours and 30 minutes from 2017-08-18T08:00:00. The output conversion will look like: 2017-08-18T03:30:00 as per utc format.

2 Answers
Related