1👍
✅
Django dateparse uses date_re
(regex) for parse_date
and date_re
format is year-month-day
date_re = re.compile(
r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})$'
)
The input you are giving is having format day/month/year
hence you are getting None
as result.
1👍
Check out strptime
import time
date_csv = "18/12/2014"
date = time.strptime(date_csv, "%d/%m/%Y")
- [Answered ]-If / else in Django View
- [Answered ]-Django-pipeline wipes out my entries in Django Database Cache
Source:stackexchange.com