[Fixed]-Django 1.9 date object import from csv

1👍

It has nothing to do with django when you want to parse an individual date string. You need to use strptime to convert datetime string into datetime objects:

import datetime
f.date = datetime.datetime.strptime('2016/01/01', '%Y/%m/%d').date()

In your case it would be:

import datetime
f.date = datetime.datetime.strptime(row[0], '%Y/%m/%d').date()

Leave a comment