Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3939182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:16:13+00:00 2026-05-20T00:16:13+00:00

I would like to globally (through my entire site, admin and front-end) adjust the

  • 0

I would like to globally (through my entire site, admin and front-end) adjust the way dates and time are displayed to my likings, but I cannot figure out what is going on with the DATE_FORMAT, DATETIME_FORMAT and TIME_FORMAT variables in settings.py.

In this question it says that the settings are ignored. The question is over a year old though. In the Django documentation it says they can be used when you have USE_L10N = True and apparently something changed in Django 1.2. According to this however there might be a bug.

I am currently using Django 1.2 and when I have USE_L10N = True it just ignores the date(time) format in settings.py. When I have USE_L10N = False it also seems to ignore them.

Is there a way to globally customize the date and time display? Or should I create my own custom formats file as Karen suggests in the Django Users Google Group post?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:16:13+00:00Added an answer on May 20, 2026 at 12:16 am

    Had same problem, solution is simple and documented. Whenever you render a date, you need to specify you want the template to render it as a date/time/short_date/datetime (e.g., {{ some_date_var | date }} and then it will render it as specified with DATE_FORMAT in your settings.py

    Example:

    >>> from django.conf import settings  # imported to show my variables in settings.py 
    >>> settings.DATE_FORMAT #  - showing my values; I modified this value
    'm/d/Y'
    >>> settings.TIME_FORMAT
    'P'
    >>> settings.DATETIME_FORMAT
    'N j, Y, P'
    >>> from django.template import Template, Context
    >>> from datetime import datetime
    >>> c = Context(dict(moon = datetime(1969, 7, 20, 20, 17, 39))) # Create context with datetime to render in a template
    >>> print c['moon'] # This is the default format of a printing datetime object 
    1969-07-20 20:17:39
    >>> print Template("default formatting : {{ moon }}\n"
                       "use DATE_FORMAT : {{ moon|date }}\n"
                       "use TIME_FORMAT : {{ moon|time }}\n"
                       "use DATETIME_FORMAT: {{ moon|date:'DATETIME_FORMAT' }}\n"
                       "use SHORT_DATETIME_FORMAT: {{ moon|date:'SHORT_DATETIME_FORMAT' }}"
                       ).render(c)
    default formatting : 1969-07-20 20:17:39
    use DATE_FORMAT : 07/20/1969
    use TIME_FORMAT : 8:17 p.m.
    use DATETIME_FORMAT: July 20, 1969, 8:17 p.m.
    use SHORT_DATETIME_FORMAT: 07/20/1969 8:17 p.m.
    

    This makes sense; e.g., the template needs to know whether it should use the DATE_FORMAT or the SHORT_DATE_FORMAT or whatever.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use the devise mailer globally, since that way I would
I would like to know the best way to globally handle The parameters dictionary
I have a table with 80 fields in it. I would like to globally
I would like to globally prevent LaTeX from hyphenating 'Objective-C'. I am aware of
there are some actions I would like to globally specify on Ajax.BeginForm. (For example,
would like to set this convention up globally if possible.
I would like to call a program or a script with a relative time
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like someone to take a look at my script and tell me where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.