0

I want to save date in my django model into desired format.

post_date = str(request.POST['date'])

I am getting date from front end is 12/21/2016 i want to save this date in my django modal is like 21-Dec-2016.

How can i do it. it will be good if you can provide some sample code.

Thanks in advance.

vikrant Verma
  • 478
  • 3
  • 8
  • 17
  • Possible duplicate of [Django string to date format](http://stackoverflow.com/questions/22918095/django-string-to-date-format) – Mikk Dec 14 '16 at 10:40
  • looks like a dupe of http://stackoverflow.com/questions/4876370/django-date-format-dd-mm-yyyy – mrehan Dec 14 '16 at 10:41

1 Answers1

0

you want to store in DB string parameter? The easiest way convert input string to date and then convert from date to string. But of course it is more logical to store date format imho

dd42
  • 138
  • 3