Skip to content

Time

datethyme.Time

Bases: OptionalTime, BaseModel

Methods:

Attributes:

model_config = ConfigDict(frozen=True) class-attribute instance-attribute

hour: int instance-attribute

minute: int = Field(default=0) class-attribute instance-attribute

second: float = Field(default=0.0) class-attribute instance-attribute

__and__(date: Date) -> DateTime

__pow__(other: Time) -> TimeSpan

validate_time(raw_time: str | dict | list | tuple) -> dict[str, str | int | float] classmethod

serialize_date() -> str

__str__() -> str

__repr__() -> str

__bool__()

__add__(mins: int | float) -> Time

__sub__(mins: int | float) -> Time

__eq__(other: Any) -> bool

__lt__(other: Time) -> bool

__gt__(other: Time) -> bool

__le__(other: Time) -> bool

__ge__(other: Time) -> bool

__hash__() -> int

parse(time_string: str) -> Self classmethod

if_valid(time_string: str) -> Self | NoneTime classmethod

Parse a string and return an instance of Time if possible; otherwise None.

now() -> Time classmethod

from_minutes(mins: int | float) -> Time classmethod

none() -> NoneTime staticmethod

to_minutes() -> float

to_seconds() -> float

minutes_to(time2: Time) -> float

minutes_from(time2: Time) -> float

add_hours_wraparound(n: int | float) -> tuple[Time, int]

add_minutes_wraparound(n: int | float) -> tuple[Time, int]

add_seconds_wraparound(n: int | float) -> tuple[Time, int]

add_hours(n: int | float) -> Time

add_minutes(n: int | float) -> Time

add_seconds(n: int | float) -> Time