I have time given in the following format.
'August 28, 2017 Mon 03:30 am - 04:00 am'
I would like to convert it to the following utc format using arrow.
time =[u'2017-08-28T03:30:00+00:00', u'2017-08-28T04:00:00+00:00']
I was able to do it with very complex string manipulation but I think there is a smart way to do it using arrow.
One of my friends was able quickly put it together and sent me this. Thought it might help others.
import arrow
from dateutil.parser import *
t = 'Fri October 20 05:15 pm - 06:15 pm'
q = t.split('-')[0].strip()
x = t.split(' ')
x = ' '.join(x[:3]) +' '+ x[-2] + ' '+ x[-1]
arrow.get(parse(q)), arrow.get(parse(x))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With