datethyme.DateTime
This is the documentation page for the DateTime class.
datethyme.DateTime
Bases: BaseModel
.
day
class-attribute
instance-attribute
day: int = Field(ge=1, le=31, frozen=FROZEN)
hour
class-attribute
instance-attribute
hour: int = Field(default=0)
minute
class-attribute
instance-attribute
minute: int = Field(default=0)
model_config
class-attribute
instance-attribute
model_config = ConfigDict(frozen=FROZEN)
month
class-attribute
instance-attribute
month: int = Field(ge=1, le=12, frozen=FROZEN)
second
class-attribute
instance-attribute
second: float = Field(default=0.0)
year
class-attribute
instance-attribute
year: int = Field(ge=1, le=1000000, frozen=FROZEN)
__ge__
__ge__(other: DateTime) -> bool
__gt__
__gt__(other: DateTime) -> bool
__le__
__le__(other: DateTime) -> bool
__lt__
__lt__(other: DateTime) -> bool
__rshift__
__rshift__(other: DateTime) -> DateTimeSpan
add
add(unit: Unit, n: int | float) -> DateTime
add_days
add_days(n: int) -> DateTime
add_hours
add_hours(n: int | float) -> DateTime
add_minutes
add_minutes(n: int | float) -> DateTime
add_seconds
add_seconds(n: int | float) -> DateTime
from_hours
classmethod
from_hours(n: float | int) -> Self
from_minutes
classmethod
from_minutes(n: float | int) -> Self
from_ordinal
classmethod
from_ordinal(ordinal: float) -> Self
from_pair
classmethod
from_pair(d: Date, t: Time) -> Self
from_seconds
classmethod
from_seconds(n: float | int, places: int | None = 10) -> Self
hours_from
hours_from(dateother: DateTime) -> float
hours_from_last
hours_from_last(other: Time) -> float
hours_to
hours_to(dateother: DateTime) -> float
hours_to_next
hours_to_next(other: Time) -> float
minutes_from
minutes_from(other: DateTime) -> float
minutes_from_last
minutes_from_last(other: Time) -> float
minutes_to
minutes_to(other: DateTime) -> float
minutes_to_next
minutes_to_next(other: Time) -> float
range
range(stop: DateTime | int, *, unit: U, step: int = 1, inclusive: bool = False) -> DateTimeRange[U]
round_hours
round_hours(round_to: int | float = 1, round_down: bool = False) -> Self
round_minutes
round_minutes(round_to: int | float = 1, round_down: bool = False) -> Self
round_seconds
round_seconds(round_to: int | float = 1, round_down: bool = False) -> Self
seconds_from
seconds_from(dateother: DateTime) -> float
seconds_from_last
seconds_from_last(other: Time) -> float
seconds_to
seconds_to(other: DateTime) -> float
seconds_to_next
seconds_to_next(other: Time) -> float
set_time
set_time(time: Time) -> Self
six
classmethod
six(year: int, month: int, day: int, hour: int, minute: int, second: float | int) -> Self
span
span(other: DateTime) -> DateTimeSpan
to
to(other: DateTime) -> DateTimeSpan
to_seconds
to_seconds(places: int = 10) -> float
validate_datetime
classmethod
validate_datetime(raw_datetime: str | dict | list | tuple) -> dict[str, int | float]
ymdhms
classmethod
ymdhms(year: int, month: int, day: int, hour: int = 0, minute: int = 0, second: float | int = 0) -> Self