Richard Knop
Richard Knop

Reputation: 83697

How to parse a string into a datetime object with Django

So I have a string like this:

2012-01-01T00:00:00Z

Hopw can I transform it into an object I can save in my model, which has this field:

start_date = models.DateTimeField()

Upvotes: 2

Views: 122

Answers (1)

RomanI
RomanI

Reputation: 403

just need to parse this string into a datetime object.

Answers are here: How to parse an ISO 8601-formatted date?

so you can use dateutil.parser or iso8601 modules.

Upvotes: 3

Related Questions