# Date and time format

**URL:** <https://forum.djangoproject.com/t/date-and-time-format/11873>\
**Category:** Django Internals\
**Created:** [January 29, 2022, 3:10pm UTC](https://forum.djangoproject.com/t/date-and-time-format/11873 "2022-01-29T15:10:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![julianov](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julianov/32/3502_2.png) [@julianov](https://forum.djangoproject.com/u/julianov)\
**Post date:** [January 29, 2022, 3:10pm UTC](https://forum.djangoproject.com/t/date-and-time-format/11873/1 "2022-01-29T15:10:21Z")

</div>

Hi everyone, I’m having trouble setting the date and time format correctly.

This is the format it shows:

YYYY-MM-DD

and I need to set it as:

DD-MM-YYYY

So, to do this I set in settings.py this:

```auto
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

DATE_INPUT_FORMATS = ['%d/%m/%Y']

USE_I18N = True

USE_L10N = True

USE_TZ = True

```

Using DATE\_INPUT\_FORMATS = [’%d/%m/%Y’] but it does not work.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 29, 2022, 5:12pm UTC](https://forum.djangoproject.com/t/date-and-time-format/11873/2 "2022-01-29T17:12:20Z")

</div>

You’re specifying an input format. Are you looking to define how dates are going to be rendered on a page? (See [DATE\_FORMAT](https://docs.djangoproject.com/en/4.0/ref/settings/#date-format))

---

<div class="post-metadata">

**Author:** ![julianov](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julianov/32/3502_2.png) [@julianov](https://forum.djangoproject.com/u/julianov)\
**Post date:** [January 29, 2022, 5:28pm UTC](https://forum.djangoproject.com/t/date-and-time-format/11873/3 "2022-01-29T17:28:46Z")

</div>

Thanks. I understand that I am specifying the input form that way. But in this case, it is the framework itself that sets the date input.

Because the models is:

```auto
class chat (models.Model):
    id = models.AutoField(primary_key=True)
    msg=models.TextField(blank=True)
    user= models.EmailField(blank=True)
    ticket = models.IntegerField(default=1000, blank=True)
    day = models.DateField(auto_now_add=True)
    time = models.TimeField(auto_now_add=True)

```

As you can see there is models.DateField(auto\_now\_add=True), so it Django which stablish the date.So what I am looking for is that when a new entry is created in the database the date that is set follows the format DD/MM/YYYY.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 29, 2022, 5:36pm UTC](https://forum.djangoproject.com/t/date-and-time-format/11873/4 "2022-01-29T17:36:58Z")

</div>

Actually, you shouldn’t _care_ how the date is formatted within the database. That’s internal, and not directly visible to you. All you should concern yourself with is ensuring that any dates you pass to the database are formatted correctly, and that you specify how you want the dates represented when you display them.
