ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class DateTime: (source)

View In Hierarchy

Provide a high-level interface for date and time operations.

All methods are class-level, using a configurable default timezone and locale backed by pendulum for immutable datetime arithmetic.

Class Method _loadConfig Load configuration for timezone and locale.
Class Method _setLocale Set the default locale for date and time formatting.
Class Method _setTimezone Set the default timezone for the application.
Class Method add Add a combination of time units to a given date.
Class Method addDays Add days to a given date.
Class Method addHours Add hours to a given datetime.
Class Method addMinutes Add minutes to a given datetime.
Class Method average Return the middle datetime between two dates.
Class Method closest Return the datetime closest to the given one among the candidates.
Class Method convertToLocal Convert a date to the configured local timezone.
Class Method datetime Create a datetime object in the configured timezone.
Class Method diff Return the full Interval between two dates.
Class Method diffForHumans Return a human-readable difference between two dates.
Class Method diffInDays Calculate the difference in days between two dates.
Class Method diffInHours Compute the difference in hours between two dates.
Class Method duration Create a Duration instance representing a span of time.
Class Method endOf Return the end of the given unit of time (e.g. 'hour', 'decade').
Class Method endOfDay Return the end of the day (23:59:59).
Class Method endOfMonth Return the end of the month (last day at 23:59:59).
Class Method endOfWeek Return the end of the week (Sunday 23:59:59).
Class Method endOfYear Return the end of the year (December 31st at 23:59:59).
Class Method farthest Return the datetime farthest from the given one among the candidates.
Class Method firstOf Return the first day of the given unit, optionally on a weekday.
Class Method formatLocal Format a date in the local timezone.
Class Method fromDatetime Convert a standard datetime object to the configured timezone.
Class Method fromFormat Parse a date string using explicit format tokens.
Class Method fromTimestamp Convert a Unix timestamp to a datetime in the configured timezone.
Class Method getLocale Return the configured locale.
Class Method getTimezone Return the configured timezone.
Class Method getZoneInfo Return the ZoneInfo object for the configured timezone.
Class Method interval Create an Interval instance between two datetimes.
Class Method isBirthday Determine if the given date shares month and day with another date.
Class Method isFuture Determine if the given date is in the future.
Class Method isLeapYear Determine if the year of the given date is a leap year.
Class Method isPast Determine if the given date is in the past.
Class Method isToday Check if the given date is today.
Class Method isWeekend Determine if the given date falls on a weekend.
Class Method lastOf Return the last day of the given unit, optionally on a weekday.
Class Method local Create a datetime object in the local system timezone.
Class Method naive Create a timezone-naive datetime object.
Class Method next Move to the next occurrence of the given day of the week.
Class Method now Get the current date and time.
Class Method nthOf Return the n-th occurrence of a weekday within the given unit.
Class Method parse Parse a date string and convert it to the configured timezone.
Class Method previous Move to the previous occurrence of the given day of the week.
Class Method startOf Return the start of the given unit of time (e.g. 'hour', 'decade').
Class Method startOfDay Return the start of the day (00:00:00).
Class Method startOfMonth Return the start of the month (first day at 00:00:00).
Class Method startOfWeek Return the start of the week (Monday 00:00:00).
Class Method startOfYear Return the start of the year (January 1st at 00:00:00).
Class Method subtract Subtract a combination of time units from a given date.
Class Method today Return the current date without time component.
Class Method tomorrow Return tomorrow's date in the specified or default timezone.
Class Method yesterday Return the date for yesterday in the specified or default timezone.
Class Variable __slots__ Undocumented
Class Variable _locale Undocumented
Class Variable _timezone Undocumented
Class Variable _zoneinfo_cache Undocumented
def _loadConfig(cls, timezone_name: str | None = None, locale: str | None = None): (source)

Load configuration for timezone and locale.

Parameters
timezone_name:str | None, optionalName of the timezone (e.g., 'America/Mexico_City'). If None, uses the default.
locale:str | None, optionalLanguage code (e.g., 'es', 'en', 'fr'). If None, uses the default.
Returns
NoneThis method does not return a value.
def _setLocale(cls, locale: str): (source)

Set the default locale for date and time formatting.

Parameters
locale:strLanguage code (e.g., 'es', 'en', 'fr').
Returns
NoneThis method does not return a value.
def _setTimezone(cls, timezone_name: str): (source)

Set the default timezone for the application.

Parameters
timezone_name:strName of the timezone (e.g., 'America/Mexico_City').
Returns
NoneThis method does not return a value.
Raises
ValueErrorIf the timezone is invalid.
def add(cls, dt: pendulum.DateTime, *, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0, hours: int = 0, minutes: int = 0, seconds: float = 0, microseconds: int = 0) -> pendulum.DateTime: (source)

Add a combination of time units to a given date.

Parameters
dt:pendulum.DateTimeThe original datetime.
years:int, optionalNumber of years to add, by default 0.
months:int, optionalNumber of months to add, by default 0.
weeks:int, optionalNumber of weeks to add, by default 0.
days:int, optionalNumber of days to add, by default 0.
hours:int, optionalNumber of hours to add, by default 0.
minutes:int, optionalNumber of minutes to add, by default 0.
seconds:float, optionalNumber of seconds to add, by default 0.
microseconds:int, optionalNumber of microseconds to add, by default 0.
Returns
pendulum.DateTimeThe resulting datetime after adding the specified units.
def addDays(cls, dt: pendulum.DateTime, days: int) -> pendulum.DateTime: (source)

Add days to a given date.

Parameters
dt:pendulum.DateTimeThe original date.
days:intNumber of days to add.
Returns
pendulum.DateTimeThe resulting date after adding the specified days.
def addHours(cls, dt: pendulum.DateTime, hours: int) -> pendulum.DateTime: (source)

Add hours to a given datetime.

Parameters
dt:pendulum.DateTimeThe original datetime.
hours:intNumber of hours to add.
Returns
pendulum.DateTimeThe resulting datetime after adding the specified hours.
def addMinutes(cls, dt: pendulum.DateTime, minutes: int) -> pendulum.DateTime: (source)

Add minutes to a given datetime.

Parameters
dt:pendulum.DateTimeThe original datetime.
minutes:intNumber of minutes to add.
Returns
pendulum.DateTimeThe resulting datetime after adding the specified minutes.
def average(cls, dt1: pendulum.DateTime, dt2: pendulum.DateTime | None = None) -> pendulum.DateTime: (source)

Return the middle datetime between two dates.

Parameters
dt1:pendulum.DateTimeThe reference datetime.
dt2:pendulum.DateTime | None, optionalThe datetime to average with. If None, uses the current datetime in the configured timezone.
Returns
pendulum.DateTimeThe datetime halfway between dt1 and dt2.
def closest(cls, dt: pendulum.DateTime, *others: pendulum.DateTime) -> pendulum.DateTime: (source)

Return the datetime closest to the given one among the candidates.

Parameters
dt:pendulum.DateTimeThe reference datetime.
*others:pendulum.DateTimeCandidate datetimes to compare against the reference.
Returns
pendulum.DateTimeThe candidate closest to dt.
def convertToLocal(cls, dt: str | stdlib_datetime | pendulum.DateTime) -> pendulum.DateTime: (source)

Convert a date to the configured local timezone.

Parameters
dt:str | datetime.datetime | pendulum.DateTimeDate to convert. Accepts string, standard datetime, or pendulum.DateTime.
Returns
pendulum.DateTimeThe date converted to the configured timezone.
def datetime(cls, year: int, month: int = 1, day: int = 1, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0, tz: str | None = None) -> pendulum.DateTime: (source)

Create a datetime object in the configured timezone.

Parameters
year:intYear component.
month:int, optionalMonth component, by default 1.
day:int, optionalDay component, by default 1.
hour:int, optionalHour component, by default 0.
minute:int, optionalMinute component, by default 0.
second:int, optionalSecond component, by default 0.
microsecond:int, optionalMicrosecond component, by default 0.
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
Returns
pendulum.DateTimeDatetime object in the specified or default timezone.
def diff(cls, dt1: pendulum.DateTime, dt2: pendulum.DateTime | None = None, *, absolute: bool = True) -> pendulum.Interval: (source)

Return the full Interval between two dates.

Parameters
dt1:pendulum.DateTimeThe reference datetime.
dt2:pendulum.DateTime | None, optionalThe datetime to compare against. If None, uses the current datetime in the configured timezone.
absolute:bool, optionalWhether to return an always-positive interval, by default True.
Returns
pendulum.IntervalThe Interval instance exposing in_years()/in_months()/ in_weeks()/in_days()/in_hours()/in_minutes()/in_seconds().
def diffForHumans(cls, dt: pendulum.DateTime, other: pendulum.DateTime | None = None, *, absolute: bool = False, locale: str | None = None) -> str: (source)

Return a human-readable difference between two dates.

Parameters
dt:pendulum.DateTimeThe reference datetime.
other:pendulum.DateTime | None, optionalThe datetime to compare against. If None, uses the current datetime.
absolute:bool, optionalWhether to remove modifiers such as 'ago' or 'from now', by default False.
locale:str | None, optionalLocale to use for the phrase. If None, uses the configured default.
Returns
strA human-readable string such as '3 weeks ago'.
def diffInDays(cls, dt1: pendulum.DateTime, dt2: pendulum.DateTime) -> int: (source)

Calculate the difference in days between two dates.

Parameters
dt1:pendulum.DateTimeThe first date.
dt2:pendulum.DateTimeThe second date.
Returns
intThe difference in days between the two dates.
def diffInHours(cls, dt1: pendulum.DateTime, dt2: pendulum.DateTime) -> int: (source)

Compute the difference in hours between two dates.

Parameters
dt1:pendulum.DateTimeThe first datetime.
dt2:pendulum.DateTimeThe second datetime.
Returns
intThe difference in hours between the two dates.
def duration(cls, *, days: float = 0, seconds: float = 0, microseconds: float = 0, milliseconds: float = 0, minutes: float = 0, hours: float = 0, weeks: float = 0, years: float = 0, months: float = 0) -> pendulum.Duration: (source)

Create a Duration instance representing a span of time.

Parameters
days:float, optionalNumber of days, by default 0.
seconds:float, optionalNumber of seconds, by default 0.
microseconds:float, optionalNumber of microseconds, by default 0.
milliseconds:float, optionalNumber of milliseconds, by default 0.
minutes:float, optionalNumber of minutes, by default 0.
hours:float, optionalNumber of hours, by default 0.
weeks:float, optionalNumber of weeks, by default 0.
years:float, optionalNumber of years, by default 0.
months:float, optionalNumber of months, by default 0.
Returns
pendulum.DurationThe resulting Duration instance.
def endOf(cls, unit: str, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the end of the given unit of time (e.g. 'hour', 'decade').

Parameters
unit:strUnit of time: 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year', 'decade' or 'century'.
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the end of the given unit.
def endOfDay(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the end of the day (23:59:59).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the end of the day.
def endOfMonth(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the end of the month (last day at 23:59:59).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the end of the month.
def endOfWeek(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the end of the week (Sunday 23:59:59).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the end of the week.
def endOfYear(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the end of the year (December 31st at 23:59:59).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the end of the year.
def farthest(cls, dt: pendulum.DateTime, *others: pendulum.DateTime) -> pendulum.DateTime: (source)

Return the datetime farthest from the given one among the candidates.

Parameters
dt:pendulum.DateTimeThe reference datetime.
*others:pendulum.DateTimeCandidate datetimes to compare against the reference.
Returns
pendulum.DateTimeThe candidate farthest from dt.
def firstOf(cls, dt: pendulum.DateTime, unit: str, day_of_week: int | None = None) -> pendulum.DateTime: (source)

Return the first day of the given unit, optionally on a weekday.

Parameters
dt:pendulum.DateTimeThe original datetime.
unit:strUnit of time: 'month', 'quarter' or 'year'.
day_of_week:int | None, optionalConstrain the result to a specific day of the week (e.g. pendulum.MONDAY). If None, returns the first day of the unit regardless of weekday.
Returns
pendulum.DateTimeThe resulting datetime.
def formatLocal(cls, dt: pendulum.DateTime | None = None, format_string: str = 'YYYY-MM-DD HH:mm:ss') -> str: (source)

Format a date in the local timezone.

Parameters
dt:pendulum.DateTime | None, optionalDate to format. If None, uses now().
format_string:str, optionalOutput format string.
Returns
strThe formatted date string.
def fromDatetime(cls, dt: stdlib_datetime | pendulum.DateTime, tz: str | None = None) -> pendulum.DateTime: (source)

Convert a standard datetime object to the configured timezone.

Parameters
dt:datetime.datetime or pendulum.DateTimeDatetime object to convert.
tz:str or None, optionalSpecific timezone name. If None, uses the configured default.
Returns
pendulum.DateTimeDatetime object in the specified or default timezone.
Raises
TypeErrorIf the input type is not supported.
def fromFormat(cls, date_string: str, fmt: str, tz: str | None = None, locale: str | None = None) -> pendulum.DateTime: (source)

Parse a date string using explicit format tokens.

Parameters
date_string:strDate string to parse.
fmt:strFormat string using pendulum's custom tokens (e.g. 'YYYY-MM-DD').
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
locale:str | None, optionalLocale to use while parsing localized tokens (e.g. month or day names). If None, uses the configured default.
Returns
pendulum.DateTimeParsed datetime object in the specified or default timezone.
def fromTimestamp(cls, timestamp: float, tz: str | None = None) -> pendulum.DateTime: (source)

Convert a Unix timestamp to a datetime in the configured timezone.

Parameters
timestamp:int | floatUnix timestamp to convert.
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
Returns
pendulum.DateTimeDatetime object in the specified or default timezone.
def getLocale(cls) -> str: (source)

Return the configured locale.

Returns
strThe currently configured locale code.
def getTimezone(cls) -> str: (source)

Return the configured timezone.

Returns
strThe currently configured timezone name.
def getZoneInfo(cls) -> ZoneInfo: (source)

Return the ZoneInfo object for the configured timezone.

Returns
ZoneInfoThe ZoneInfo instance corresponding to the configured timezone.
def interval(cls, start: pendulum.DateTime, end: pendulum.DateTime, *, absolute: bool = False) -> pendulum.Interval: (source)

Create an Interval instance between two datetimes.

Parameters
start:pendulum.DateTimeThe start of the interval.
end:pendulum.DateTimeThe end of the interval.
absolute:bool, optionalWhether to force a positive interval regardless of the order of start and end, by default False.
Returns
pendulum.IntervalThe resulting Interval instance.
def isBirthday(cls, dt: pendulum.DateTime, other: pendulum.DateTime | None = None) -> bool: (source)

Determine if the given date shares month and day with another date.

Parameters
dt:pendulum.DateTimeThe reference date (e.g. a date of birth).
other:pendulum.DateTime | None, optionalThe date to compare against. If None, uses the current datetime in the configured timezone.
Returns
boolTrue if both dates share the same month and day, False otherwise.
def isFuture(cls, dt: pendulum.DateTime) -> bool: (source)

Determine if the given date is in the future.

Parameters
dt:pendulum.DateTimeThe datetime to check.
Returns
boolTrue if the date is in the future, False otherwise.
def isLeapYear(cls, dt: pendulum.DateTime | None = None) -> bool: (source)

Determine if the year of the given date is a leap year.

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to check. If None, uses the current datetime.
Returns
boolTrue if the year is a leap year, False otherwise.
def isPast(cls, dt: pendulum.DateTime) -> bool: (source)

Determine if the given date is in the past.

Parameters
dt:pendulum.DateTimeThe datetime to check.
Returns
boolTrue if the date is in the past, False otherwise.
def isToday(cls, dt: pendulum.DateTime) -> bool: (source)

Check if the given date is today.

Parameters
dt:pendulum.DateTimeThe datetime to check.
Returns
boolTrue if the date is today, False otherwise.
def isWeekend(cls, dt: pendulum.DateTime | None = None) -> bool: (source)

Determine if the given date falls on a weekend.

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to check. If None, uses the current datetime.
Returns
boolTrue if the date is Saturday or Sunday, False otherwise.
def lastOf(cls, dt: pendulum.DateTime, unit: str, day_of_week: int | None = None) -> pendulum.DateTime: (source)

Return the last day of the given unit, optionally on a weekday.

Parameters
dt:pendulum.DateTimeThe original datetime.
unit:strUnit of time: 'month', 'quarter' or 'year'.
day_of_week:int | None, optionalConstrain the result to a specific day of the week (e.g. pendulum.FRIDAY). If None, returns the last day of the unit regardless of weekday.
Returns
pendulum.DateTimeThe resulting datetime.
def local(cls, year: int, month: int = 1, day: int = 1, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0) -> pendulum.DateTime: (source)

Create a datetime object in the local system timezone.

Parameters
year:intYear component.
month:int, optionalMonth component, by default 1.
day:int, optionalDay component, by default 1.
hour:int, optionalHour component, by default 0.
minute:int, optionalMinute component, by default 0.
second:int, optionalSecond component, by default 0.
microsecond:int, optionalMicrosecond component, by default 0.
Returns
pendulum.DateTimeDatetime object expressed in the local system timezone.
def naive(cls, year: int, month: int = 1, day: int = 1, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0) -> pendulum.DateTime: (source)

Create a timezone-naive datetime object.

Parameters
year:intYear component.
month:int, optionalMonth component, by default 1.
day:int, optionalDay component, by default 1.
hour:int, optionalHour component, by default 0.
minute:int, optionalMinute component, by default 0.
second:int, optionalSecond component, by default 0.
microsecond:int, optionalMicrosecond component, by default 0.
Returns
pendulum.DateTimeDatetime object with no timezone information attached.
def next(cls, dt: pendulum.DateTime, day_of_week: int | None = None, *, keep_time: bool = False) -> pendulum.DateTime: (source)

Move to the next occurrence of the given day of the week.

Parameters
dt:pendulum.DateTimeThe original datetime.
day_of_week:int | None, optionalTarget day of the week (e.g. pendulum.WEDNESDAY). If None, uses the day of the week of dt.
keep_time:bool, optionalWhether to keep the time component instead of resetting it to midnight, by default False.
Returns
pendulum.DateTimeThe datetime of the next matching day.
def now(cls, tz: str | None = None) -> pendulum.DateTime: (source)

Get the current date and time.

Parameters
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
Returns
pendulum.DateTimeThe current date and time in the specified or default timezone.
def nthOf(cls, dt: pendulum.DateTime, unit: str, nth: int, day_of_week: int) -> pendulum.DateTime: (source)

Return the n-th occurrence of a weekday within the given unit.

Parameters
dt:pendulum.DateTimeThe original datetime.
unit:strUnit of time: 'month', 'quarter' or 'year'.
nth:intThe occurrence index to look for (1-based).
day_of_week:intTarget day of the week (e.g. pendulum.MONDAY).
Returns
pendulum.DateTimeThe resulting datetime.
Raises
PendulumExceptionIf the given occurrence does not exist within the unit.
def parse(cls, date_string: str, tz: str | None = None, *, strict: bool = True) -> pendulum.DateTime: (source)

Parse a date string and convert it to the configured timezone.

Parameters
date_string:strDate string to parse.
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
strict:bool, optionalWhether to use strict parsing mode, by default True.
Returns
pendulum.DateTimeParsed datetime object in the specified or default timezone.
def previous(cls, dt: pendulum.DateTime, day_of_week: int | None = None, *, keep_time: bool = False) -> pendulum.DateTime: (source)

Move to the previous occurrence of the given day of the week.

Parameters
dt:pendulum.DateTimeThe original datetime.
day_of_week:int | None, optionalTarget day of the week (e.g. pendulum.WEDNESDAY). If None, uses the day of the week of dt.
keep_time:bool, optionalWhether to keep the time component instead of resetting it to midnight, by default False.
Returns
pendulum.DateTimeThe datetime of the previous matching day.
def startOf(cls, unit: str, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the start of the given unit of time (e.g. 'hour', 'decade').

Parameters
unit:strUnit of time: 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year', 'decade' or 'century'.
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the start of the given unit.
def startOfDay(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the start of the day (00:00:00).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the start of the day.
def startOfMonth(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the start of the month (first day at 00:00:00).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the start of the month.
def startOfWeek(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the start of the week (Monday 00:00:00).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the start of the week.
def startOfYear(cls, dt: pendulum.DateTime | None = None, tz: str | None = None) -> pendulum.DateTime: (source)

Return the start of the year (January 1st at 00:00:00).

Parameters
dt:pendulum.DateTime | None, optionalThe datetime to use. If None, uses the current datetime.
tz:str | None, optionalThe timezone to use. If None, uses the configured default.
Returns
pendulum.DateTimeThe datetime at the start of the year.
def subtract(cls, dt: pendulum.DateTime, *, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0, hours: int = 0, minutes: int = 0, seconds: float = 0, microseconds: int = 0) -> pendulum.DateTime: (source)

Subtract a combination of time units from a given date.

Parameters
dt:pendulum.DateTimeThe original datetime.
years:int, optionalNumber of years to subtract, by default 0.
months:int, optionalNumber of months to subtract, by default 0.
weeks:int, optionalNumber of weeks to subtract, by default 0.
days:int, optionalNumber of days to subtract, by default 0.
hours:int, optionalNumber of hours to subtract, by default 0.
minutes:int, optionalNumber of minutes to subtract, by default 0.
seconds:float, optionalNumber of seconds to subtract, by default 0.
microseconds:int, optionalNumber of microseconds to subtract, by default 0.
Returns
pendulum.DateTimeThe resulting datetime after subtracting the specified units.
def today(cls, tz: str | None = None) -> pendulum.Date: (source)

Return the current date without time component.

Parameters
tz:str | None, optionalSpecific timezone name. If None, uses the configured default.
Returns
pendulum.DateThe current date in the specified or default timezone.
def tomorrow(cls, tz: str | None = None) -> pendulum.Date: (source)

Return tomorrow's date in the specified or default timezone.

Parameters
tz:str | None, optionalTimezone name. If None, uses the configured default.
Returns
pendulum.DateThe date for tomorrow in the specified or default timezone.
def yesterday(cls, tz: str | None = None) -> pendulum.Date: (source)

Return the date for yesterday in the specified or default timezone.

Parameters
tz:str | None, optionalTimezone name. If None, uses the configured default.
Returns
pendulum.DateThe date for yesterday in the specified or default timezone.
__slots__: tuple = (source)

Undocumented

Undocumented

_timezone: str = (source)

Undocumented

_zoneinfo_cache: ClassVar[dict[str, ZoneInfo]] = (source)

Undocumented