Return a new time with new values for the specified fields.
(self, hour=None, minute=None, second=None, microsecond=None,
tzinfo=True, *, fold=None)
| 1684 | return offset |
| 1685 | |
| 1686 | def replace(self, hour=None, minute=None, second=None, microsecond=None, |
| 1687 | tzinfo=True, *, fold=None): |
| 1688 | """Return a new time with new values for the specified fields.""" |
| 1689 | if hour is None: |
| 1690 | hour = self.hour |
| 1691 | if minute is None: |
| 1692 | minute = self.minute |
| 1693 | if second is None: |
| 1694 | second = self.second |
| 1695 | if microsecond is None: |
| 1696 | microsecond = self.microsecond |
| 1697 | if tzinfo is True: |
| 1698 | tzinfo = self.tzinfo |
| 1699 | if fold is None: |
| 1700 | fold = self._fold |
| 1701 | return type(self)(hour, minute, second, microsecond, tzinfo, fold=fold) |
| 1702 | |
| 1703 | __replace__ = replace |
| 1704 |