[Answered ]-Convert django datetime format to template type formatting

0👍

import datetime

template_type_value = datetime.datetime.strptime(date, '%Y-%m-%d %H:%M').strftime('%b %d, %Y, %I:%M %p')

2👍

That’s not the django way, you should use django template formatters, this is how it works:
{{ value|date:"N j, o," }} {{ value|time:"P"}}
April 22, 2015, 11:53 a.m.

Where value is the datetime value you retrieve from the database with DateTimeField

You should make the changes in your templates because they are the one responsible for the display, your views shouldn’t be bloated with something like the accepted answer
Edit: unless you are doing ajax lol

the docs:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

Leave a comment