How can I parse this date:
2016-06-10T00:00:00Z
into:
Jun 6, 2016
Using Python 2.7 without a third-party lib?
I have seen dateparser and datetime, but am not sure the best approach to take.
How can I parse this date:
2016-06-10T00:00:00Z
into:
Jun 6, 2016
Using Python 2.7 without a third-party lib?
I have seen dateparser and datetime, but am not sure the best approach to take.
You probably need to study the datetime module capabilities more, but this does what you ask:
>>> d = "2016-06-10T00:00:00Z"
>>> d2 = d.split("-")
>>> d2
['2016', '06', '10T00:00:00Z']
>>> m = ["Jan", "Feb", "Mar", "Apr", "May", "June"]
>>>
>>> result = m[int(d2[1])-1] + " " + d2[2][:2] + ", " + d2[0]
>>>
'June 10, 2016'
Of course put all months in m. I didn't feel like typing all 12!