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)
| 1929 | self._tzinfo, fold=self.fold) |
| 1930 | |
| 1931 | def replace(self, year=None, month=None, day=None, hour=None, |
| 1932 | minute=None, second=None, microsecond=None, tzinfo=True, |
| 1933 | *, fold=None): |
| 1934 | """Return a new datetime with new values for the specified fields.""" |
| 1935 | if year is None: |
| 1936 | year = self.year |
| 1937 | if month is None: |
| 1938 | month = self.month |
| 1939 | if day is None: |
| 1940 | day = self.day |
| 1941 | if hour is None: |
| 1942 | hour = self.hour |
| 1943 | if minute is None: |
| 1944 | minute = self.minute |
| 1945 | if second is None: |
| 1946 | second = self.second |
| 1947 | if microsecond is None: |
| 1948 | microsecond = self.microsecond |
| 1949 | if tzinfo is True: |
| 1950 | tzinfo = self.tzinfo |
| 1951 | if fold is None: |
| 1952 | fold = self.fold |
| 1953 | return type(self)(year, month, day, hour, minute, second, |
| 1954 | microsecond, tzinfo, fold=fold) |
| 1955 | |
| 1956 | def _local_timezone(self): |
| 1957 | if self.tzinfo is None: |
no test coverage detected