diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2021-05-10 15:33:48 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-05-12 08:17:06 +0200 |
| commit | 34363a391bad5a007f2ab35a6d8c4ece4c3234f6 (patch) | |
| tree | ea43d8319f7ff0d71b36c423518a5fc1380762d4 /django/utils | |
| parent | b1a4b1f0bdf05adbd3dc4dde14228e68da54c1a3 (diff) | |
Fixed #32735 -- Made DateFormat.Y() return a zero-padded year.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/dateformat.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py index 38e89c47bb..4833b5af2c 100644 --- a/django/utils/dateformat.py +++ b/django/utils/dateformat.py @@ -313,8 +313,8 @@ class DateFormat(TimeFormat): return '%02d' % (self.data.year % 100) def Y(self): - "Year, 4 digits; e.g. '1999'" - return self.data.year + """Year, 4 digits with leading zeros; e.g. '1999'.""" + return '%04d' % self.data.year def z(self): """Day of the year, i.e. 1 to 366.""" |
