I am trying to change the DateTime format in one of the django forms.
The format I would like to accept is: day month year hour_minute_seconds time zone August 11, 2015 12:00:00 GMT →% d% b% Y% H:% M:% S% Z
I did some tests, but I could not find the correct path.
I disabled L10N in the settings.py file to use the month b% format.
This is the contents of my forms.py files
from django import forms from django.forms import DateTimeField from web.apps.customer.models import Reported_VPN_User class Customer_settings_vpn_Form(forms.ModelForm): event_date = DateTimeField(widget=forms.widgets.DateTimeInput(format="%d %b %Y %H:%M:%S %Z")) class Meta: model = Reported_VPN_User fields = '__all__'
When I try to enter a date in the required format, the form does not allow me to go forward.
I check DATETIME_INPUT_FORMAT ( https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-DATETIME_FORMAT ) and I don't see what I'm looking for, but I check the documentation for the python date ( https: // docs.python.org/2/library/datetime.html#strftime-strptime-behavior ) I see that this should be possible.
How do I change the date and time format so that I can do it on demand?
ps: I am not an expert in django.
Borja source share