from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from dateutil.tz import gettz
from datetime import datetime, timedelta
input_time = '2019-02-01 09:50:08+11:00'
parsed=parse(input_time)
print parsed.tzinfo
I have a time input string:
input_time = '2019-02-01 09:50:08+11:00'
I want to convert it into this format: YYYY-MM-DD HH:MM:SS. Basically, adding the offset to the actual time object. For the above example I am looking for below output:
input_time_converted = '2019-02-01 20:50:08'
Found some useful stuff in dateutil library to parse the date object passed as a string and get the offset details but it gives me this output:
tzoffset(None, 39600)
But I don't know how to get the actual digits from the above and do the rest of the maths.
I have tried to call it with -as explained in the official dateutil parser documentation-
print parsed.tzinfo.tzoffset
But didn't work.