Undocumented
Constant | FORMAT_SETTINGS |
Undocumented |
Constant | ISO_INPUT_FORMATS |
Undocumented |
Variable | get_format_lazy |
Undocumented |
Function | date_format |
Format a datetime.date or datetime.datetime object using a localizable format. |
Function | get_format |
For a specific format type, return the format for the current language (locale). Default to the format in the settings. format_type is the name of the format, e.g. 'DATE_FORMAT'. |
Function | get_format_modules |
Return a list of the format modules found. |
Function | iter_format_modules |
Find format modules. |
Function | localize |
Check if value is a localizable type (date, number...) and return it formatted as a string using current locale format. |
Function | localize_input |
Check if an input value is a localizable type and return it formatted with the appropriate formatting string of the current locale. |
Function | number_format |
Format a numeric value using localization settings. |
Function | reset_format_cache |
Clear any cached formats. |
Function | sanitize_separators |
Sanitize a value according to the current decimal and thousand separator setting. Used with form field input. |
Function | sanitize_strftime_format |
Ensure that certain specifiers are correctly padded with leading zeros. |
Function | time_format |
Format a datetime.time object using a localizable format. |
Variable | _format_cache |
Undocumented |
Variable | _format_modules_cache |
Undocumented |
Undocumented
Value |
|
dict
=
Undocumented
Value |
|
Format a datetime.date or datetime.datetime object using a localizable format.
If use_l10n is provided and is not None, that will force the value to be localized (or not), overriding the value of settings.USE_L10N.
For a specific format type, return the format for the current language (locale). Default to the format in the settings. format_type is the name of the format, e.g. 'DATE_FORMAT'.
If use_l10n is provided and is not None, it forces the value to be localized (or not), overriding the value of settings.USE_L10N.
Check if value is a localizable type (date, number...) and return it formatted as a string using current locale format.
If use_l10n is provided and is not None, it forces the value to be localized (or not), overriding the value of settings.USE_L10N.
Format a numeric value using localization settings.
If use_l10n is provided and is not None, it forces the value to be localized (or not), overriding the value of settings.USE_L10N.
Clear any cached formats.
This method is provided primarily for testing purposes, so that the effects of cached formats can be removed.
Ensure that certain specifiers are correctly padded with leading zeros.
For years < 1000 specifiers %C, %F, %G, and %Y don't work as expected for strftime provided by glibc on Linux as they don't pad the year or century with leading zeros. Support for specifying the padding explicitly is available, however, which can be used to fix this issue.
FreeBSD, macOS, and Windows do not support explicitly specifying the padding, but return four digit years (with leading zeros) as expected.
This function checks whether the %Y produces a correctly padded string and, if not, makes the following substitutions:
See https://bugs.python.org/issue13305 for more details.