Monday, June 25, 2012

Re: change default date format to dd-mm-YYYY

Very useful, thanks.
But how can I change the date format also in the admin interface when using DateField?

Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto:
On 25/06/2012 6:51pm, ledzgio wrote:
> How can I change default project/app date format to dd-mm-YYYY?

This is straight from the Python 2.7 docs.

>>>import datetime
>>>d = datetime.datetime(2010, 7, 4, 12, 15, 58)
 >>> '{:%Y-%m-%d%H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

or in a template ...
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

hth

Mike

>
> thanks
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto:
On 25/06/2012 6:51pm, ledzgio wrote:
> How can I change default project/app date format to dd-mm-YYYY?

This is straight from the Python 2.7 docs.

>>>import datetime
>>>d = datetime.datetime(2010, 7, 4, 12, 15, 58)
 >>> '{:%Y-%m-%d%H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

or in a template ...
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

hth

Mike

>
> thanks
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto:
On 25/06/2012 6:51pm, ledzgio wrote:
> How can I change default project/app date format to dd-mm-YYYY?

This is straight from the Python 2.7 docs.

>>>import datetime
>>>d = datetime.datetime(2010, 7, 4, 12, 15, 58)
 >>> '{:%Y-%m-%d%H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

or in a template ...
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

hth

Mike

>
> thanks
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto:
On 25/06/2012 6:51pm, ledzgio wrote:
> How can I change default project/app date format to dd-mm-YYYY?

This is straight from the Python 2.7 docs.

>>>import datetime
>>>d = datetime.datetime(2010, 7, 4, 12, 15, 58)
 >>> '{:%Y-%m-%d%H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

or in a template ...
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

hth

Mike

>
> thanks
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



Il giorno lunedì 25 giugno 2012 11:05:38 UTC+2, Mike Dewhirst ha scritto:
On 25/06/2012 6:51pm, ledzgio wrote:
> How can I change default project/app date format to dd-mm-YYYY?

This is straight from the Python 2.7 docs.

>>>import datetime
>>>d = datetime.datetime(2010, 7, 4, 12, 15, 58)
 >>> '{:%Y-%m-%d%H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

or in a template ...
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

hth

Mike

>
> thanks
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Z3fcdtqKpvYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oJN-bubQ5v4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate