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), otherwise it's always localized.
(value, format=None, use_l10n=None)
| 145 | |
| 146 | |
| 147 | def date_format(value, format=None, use_l10n=None): |
| 148 | """ |
| 149 | Format a datetime.date or datetime.datetime object using a |
| 150 | localizable format. |
| 151 | |
| 152 | If use_l10n is provided and is not None, that will force the value to |
| 153 | be localized (or not), otherwise it's always localized. |
| 154 | """ |
| 155 | return dateformat.format( |
| 156 | value, get_format(format or "DATE_FORMAT", use_l10n=use_l10n) |
| 157 | ) |
| 158 | |
| 159 | |
| 160 | def time_format(value, format=None, use_l10n=None): |