On Aug 28, 3:19 am, Jigar <jigar.vana...@gmail.com> wrote:
> Hi All,
>
> I am trying to add the '%d-%m-%Y' format in DateTimefield. As django
> does not support this format so when I add different date formats, it
> gives "invalid date/time" error in django console.This error occurs
> because the form is not valid(form.is_valid()) as above mentioned date
> format is not supported by django.

It is not correct to say that Django does not support that format.
That format is not one that is accepted by default as an input format
for the DateTimeField form field.  However, you can easily specify
your own input_formats and then your form will accept that format:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#datetimefield

> Also, I want to store this date in
> the mysql database.
>

It does not make sense to say you want to store that format in MySQL.
The value stored in MySQL is a DATETIME, independent of any particular
format.  Since you are using Django you do not need to be concerned
with what format is used when Django stores the data to MySQL or
retrieves it from MySQL.  What you need to adjust is the input formats
your field accepts, and the output format used by your form field's
widget to display existing data (see the format parameter here, for
example: 
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.DateTimeInput)

Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to