0

I am creating Django Form and want to use TimeField with 24-hour format.

However when I try using Django widget, I get the 12-hour format. This is my code.

start_time = forms.TimeField(
    label="Start Time",
    widget=forms.TextInput(
        attrs={'type': 'time'}
    )
)

How to change it to 24-hour format?

Nafees Anwar
  • 6,324
  • 2
  • 23
  • 42
alcantula
  • 169
  • 1
  • 14
  • Try this https://stackoverflow.com/questions/48514222/django-admin-datetimefield-showing-24hr-format-time/48521723 – D S Apr 13 '19 at 12:04
  • @DS I have tried adding TIME_INPUT_FORMATS and USE_L10N but nothing happened. – alcantula Apr 13 '19 at 12:13
  • It has nothing to do with django. HTML5 input type time only supports 12 hour format. Please see more details here. https://stackoverflow.com/questions/32609407/html-input-time-in-24-format – Nafees Anwar Apr 13 '19 at 12:19

0 Answers0