Django with fixed date and time formats

Format: Python
 ( View Raw)
Date: Thu, 22 Aug 2024 at 12:22:17

# project/settings.py

LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
FORMAT_MODULE_PATH = ['project.formats']


# project/formats/en/formats.py

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

SHORT_DATE_FORMAT = DATE_FORMAT
SHORT_DATETIME_FORMAT = DATETIME_FORMAT