[Django]-Change DateTimeField FORMAT in Django version 3.2.2

2👍

The DATETIME_FORMAT setting [Django-doc] works with the formatting specifications like PHP does that.

So as format, you should use:

DATETIME_FORMAT = 'd-m-Y H:i:s'

Note that the formatting is slightly different [PHP datetime specs]. PHP uses i for the minutes; and a lowercase s for the seconds:

format character Description Example
i Minutes with leading zeros 00 to 59
s Seconds with leading zeros 00 through 59

The Django documentation also has the format characters listed as @AbdulAzizBarkat says.

Leave a comment