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)
| 2081 | self._tzinfo, fold=self.fold) |
| 2082 | |
| 2083 | def replace(self, year=None, month=None, day=None, hour=None, |
| 2084 | minute=None, second=None, microsecond=None, tzinfo=True, |
| 2085 | *, fold=None): |
| 2086 | """Return a new datetime with new values for the specified fields.""" |
| 2087 | if year is None: |
| 2088 | year = self.year |
| 2089 | if month is None: |
| 2090 | month = self.month |
| 2091 | if day is None: |
| 2092 | day = self.day |
| 2093 | if hour is None: |
| 2094 | hour = self.hour |
| 2095 | if minute is None: |
| 2096 | minute = self.minute |
| 2097 | if second is None: |
| 2098 | second = self.second |
| 2099 | if microsecond is None: |
| 2100 | microsecond = self.microsecond |
| 2101 | if tzinfo is True: |
| 2102 | tzinfo = self.tzinfo |
| 2103 | if fold is None: |
| 2104 | fold = self.fold |
| 2105 | return type(self)(year, month, day, hour, minute, second, |
| 2106 | microsecond, tzinfo, fold=fold) |
| 2107 | |
| 2108 | __replace__ = replace |
| 2109 |
no outgoing calls
no test coverage detected