Refer to documentation for :meth:`datetime.datetime.strftime` *fmt* is a :meth:`datetime.datetime.strftime` format string. Warning: For years before 1900, depending upon the current locale it is possible that the year displayed with %x might be incorrect. F
(self, dt, fmt=None)
| 698 | |
| 699 | @cbook.deprecated("3.0") |
| 700 | def strftime(self, dt, fmt=None): |
| 701 | """ |
| 702 | Refer to documentation for :meth:`datetime.datetime.strftime` |
| 703 | |
| 704 | *fmt* is a :meth:`datetime.datetime.strftime` format string. |
| 705 | |
| 706 | Warning: For years before 1900, depending upon the current |
| 707 | locale it is possible that the year displayed with %x might |
| 708 | be incorrect. For years before 100, %y and %Y will yield |
| 709 | zero-padded strings. |
| 710 | """ |
| 711 | if fmt is None: |
| 712 | fmt = self.fmt |
| 713 | fmt = self.illegal_s.sub(r"\1", fmt) |
| 714 | fmt = fmt.replace("%s", "s") |
| 715 | if dt.year >= 1900: |
| 716 | # Note: in python 3.3 this is okay for years >= 1000, |
| 717 | # refer to http://bugs.python.org/issue1777412 |
| 718 | return cbook.unicode_safe(dt.strftime(fmt)) |
| 719 | |
| 720 | return self.strftime_pre_1900(dt, fmt) |
| 721 | |
| 722 | |
| 723 | class IndexDateFormatter(ticker.Formatter): |