Return a new datetime with new values for the specified fields.
(self, year=None, month=None, day=None, hour=None,
minute=None, second=None, microsecond=None, tzinfo=True,
*, fold=None)
| 2041 | self._tzinfo, fold=self.fold) |
| 2042 | |
| 2043 | def replace(self, year=None, month=None, day=None, hour=None, |
| 2044 | minute=None, second=None, microsecond=None, tzinfo=True, |
| 2045 | *, fold=None): |
| 2046 | """Return a new datetime with new values for the specified fields.""" |
| 2047 | if year is None: |
| 2048 | year = self.year |
| 2049 | if month is None: |
| 2050 | month = self.month |
| 2051 | if day is None: |
| 2052 | day = self.day |
| 2053 | if hour is None: |
| 2054 | hour = self.hour |
| 2055 | if minute is None: |
| 2056 | minute = self.minute |
| 2057 | if second is None: |
| 2058 | second = self.second |
| 2059 | if microsecond is None: |
| 2060 | microsecond = self.microsecond |
| 2061 | if tzinfo is True: |
| 2062 | tzinfo = self.tzinfo |
| 2063 | if fold is None: |
| 2064 | fold = self.fold |
| 2065 | return type(self)(year, month, day, hour, minute, second, |
| 2066 | microsecond, tzinfo, fold=fold) |
| 2067 | |
| 2068 | __replace__ = replace |
| 2069 |
no outgoing calls
no test coverage detected