When I use the following
created = models.DateTimeField('date published')
it displays time like this
23:12:06
instead of
11:12:06
I want it to display time in 12 hr not 24. Also when I press the now widget the time is 4 minutes behind. Any help would be appreciatecd
You can change input format for time field as follow:
or
The %I indicates a 12 hour clock format whereas the %H indicates a 24 hour clock format.
in django we have some defined formats
time
date
datetime
you can use these formats to customize your fields
also see official doc
Django have built-in date formatting, like this:
created = DateTimeField(input_formats=['%Y-%m-%d %I:%M %p'])
Here is the full cheat-sheet about how this letters work: http://blog.tkbe.org/archive/date-filter-cheat-sheet/So, to implement 12hour format, use 'h' or 'g' depending on if you want to have leading zeros or not
It is also mentioned in django doc: https://docs.djangoproject.com/en/dev/ref/forms/fields/#datetimefield
This is for dev version, i dont know which one you are using
Is your TIME_ZONE in settings correct ?