0

I have a date string which is in the form of 2016-03-15 14:41:48.901013+05:30. I want to change it to a datetime object in the same format i.e 2016-03-17 14:41:48.901013+05:30. Please help me in doing this.

I am using django 1.8.

the_unknown_spirit
  • 2,518
  • 7
  • 34
  • 56

1 Answers1

1

Install dateutil

pip install python-dateutil

Code:

from dateutil import parser
dt = parser.parse("2016-03-15 14:41:48.901013+05:30")
Vaibhav Mule
  • 5,016
  • 4
  • 35
  • 52