MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / start_of

Method start_of

src/pendulum/datetime.py:749–767  ·  view source on GitHub ↗

Returns a copy of the instance with the time reset with the following rules: * second: microsecond set to 0 * minute: second and microsecond set to 0 * hour: minute, second and microsecond set to 0 * day: time to 00:00:00 * week: date to firs

(self, unit: str)

Source from the content-addressed store, hash-verified

747
748 # Modifiers
749 def start_of(self, unit: str) -> Self:
750 """
751 Returns a copy of the instance with the time reset
752 with the following rules:
753
754 * second: microsecond set to 0
755 * minute: second and microsecond set to 0
756 * hour: minute, second and microsecond set to 0
757 * day: time to 00:00:00
758 * week: date to first day of the week and time to 00:00:00
759 * month: date to first day of the month and time to 00:00:00
760 * year: date to first day of the year and time to 00:00:00
761 * decade: date to first day of the decade and time to 00:00:00
762 * century: date to first day of century and time to 00:00:00
763 """
764 if unit not in self._MODIFIERS_VALID_UNITS:
765 raise ValueError(f'Invalid unit "{unit}" for start_of()')
766
767 return cast("Self", getattr(self, f"_start_of_{unit}")())
768
769 def end_of(self, unit: str) -> Self:
770 """

Callers 8

nextMethod · 0.95
previousMethod · 0.95
_first_of_monthMethod · 0.95
_last_of_monthMethod · 0.95
_start_of_weekMethod · 0.45
_nth_of_monthMethod · 0.45
_nth_of_quarterMethod · 0.45
_nth_of_yearMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected