datetime

Standard library module View source
variable MINYEAR
MINYEAR = 1
variable MAXYEAR
MAXYEAR = 9999
variable MAXORDINAL
MAXORDINAL = 3652059
variable MAX_DELTA_DAYS
MAX_DELTA_DAYS = 999999999
class timedelta
@tuple
class timedelta
Fields 3
min ClassVar[timedelta]
max ClassVar[timedelta]
resolution ClassVar[timedelta]
Constructors 2
__new__
__new__(days: float = 0, seconds: float = 0, microseconds: float = 0, milliseconds: float = 0, minutes: float = 0, hours: float = 0, weeks: float = 0)
__new__
__new__(days: int)
Properties 3
days
@property
days(self)
seconds
@property
seconds(self)
microseconds
@property
microseconds(self)
Methods 1
total_seconds
total_seconds(self)
Special methods 20
__repr__
__repr__(self)
__str__
__str__(self)
__add__
__add__(self, other: timedelta)
__sub__
__sub__(self, other: timedelta)
__mul__
__mul__(self, other: int)
__mul__(self, other: float)
__rmul__
__rmul__(self, other: int)
__rmul__(self, other: float)
__truediv__
__truediv__(self, other: timedelta)
__truediv__(self, other: float)
__truediv__(self, other: int)
__floordiv__
__floordiv__(self, other: timedelta)
__floordiv__(self, other: int)
__mod__
__mod__(self, other: timedelta)
__divmod__
__divmod__(self, other: timedelta)
__pos__
__pos__(self)
__neg__
__neg__(self)
__abs__
__abs__(self)
__eq__
__eq__(self, other: timedelta)
__ne__
__ne__(self, other: timedelta)
__lt__
__lt__(self, other: timedelta)
__le__
__le__(self, other: timedelta)
__gt__
__gt__(self, other: timedelta)
__ge__
__ge__(self, other: timedelta)
__bool__
__bool__(self)
class IsoCalendarDate
@tuple
class IsoCalendarDate
Fields 3
year int
week int
weekday int
Special methods 1
__repr__
__repr__(self)
class date
@tuple
class date
Fields 3
min ClassVar[date]
max ClassVar[date]
resolution ClassVar[timedelta]
Constructors 1
__new__
__new__(year: int, month: int, day: int)
Properties 3
year
@property
year(self)
month
@property
month(self)
day
@property
day(self)
Methods 13
today
today()
fromtimestamp
fromtimestamp(timestamp)
fromordinal
fromordinal(ordinal: int)
fromisoformat
fromisoformat(date_string: str)
fromisocalendar
fromisocalendar(year, week, day)
replace
replace(self, year: int = -1, month: int = -1, day: int = -1)
timetuple
timetuple(self)
toordinal
toordinal(self)
weekday
weekday(self)
isoweekday
isoweekday(self)
isocalendar
isocalendar(self)
isoformat
isoformat(self)
ctime
ctime(self)
Special methods 11
__repr__
__repr__(self)
__add__
__add__(self, other: timedelta)
__sub__
__sub__(self, other: timedelta)
__sub__(self, other: date)
__eq__
__eq__(self, other: date)
__ne__
__ne__(self, other: date)
__lt__
__lt__(self, other: date)
__le__
__le__(self, other: date)
__gt__
__gt__(self, other: date)
__ge__
__ge__(self, other: date)
__bool__
__bool__(self)
__str__
__str__(self)
class time
@tuple
class time
Fields 3
min ClassVar[time]
max ClassVar[time]
resolution ClassVar[timedelta]
Constructors 1
__new__
__new__(hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0)
Properties 4
hour
@property
hour(self)
minute
@property
minute(self)
second
@property
second(self)
microsecond
@property
microsecond(self)
Methods 3
fromisoformat
fromisoformat(time_string: str)
replace
replace(self, hour: int = -1, minute: int = -1, second: int = -1, microsecond: int = -1)
isoformat
isoformat(self, timespec: Literal[str] = "auto")
Special methods 3
__repr__
__repr__(self)
__str__
__str__(self)
__bool__
__bool__(self)
class datetime
@tuple
class datetime
Fields 3
min ClassVar[datetime]
max ClassVar[datetime]
resolution ClassVar[timedelta]
Constructors 1
__new__
__new__(year: int, month: int, day: int, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0)
Properties 7
year
@property
year(self)
month
@property
month(self)
day
@property
day(self)
hour
@property
hour(self)
minute
@property
minute(self)
second
@property
second(self)
microsecond
@property
microsecond(self)
Methods 21
date
date(self)
time
time(self)
today
today()
now
now()
utcnow
utcnow()
fromtimestamp
fromtimestamp(timestamp)
utcfromtimestamp
utcfromtimestamp(timestamp)
fromordinal
fromordinal(ordinal: int)
combine
combine(date: date, time: time)
fromisoformat
fromisoformat(date_string: str)
fromisocalendar
fromisocalendar(year: int, week: int, day: int)
replace
replace(self, year: int = -1, month: int = -1, day: int = -1, hour: int = -1, minute: int = -1, second: int = -1, microsecond: int = -1)
timetuple
timetuple(self)
utctimetuple
utctimetuple(self)
toordinal
toordinal(self)
timestamp
timestamp(self)
weekday
weekday(self)
isoweekday
isoweekday(self)
isocalendar
isocalendar(self)
isoformat
isoformat(self, sep: str = "T", timespec: Literal[str] = "auto")
ctime
ctime(self)
Special methods 11
__repr__
__repr__(self)
__str__
__str__(self)
__add__
__add__(self, other: timedelta)
__sub__
__sub__(self, other: timedelta)
__sub__(self, other: datetime)
__eq__
__eq__(self, other: datetime)
__ne__
__ne__(self, other: datetime)
__lt__
__lt__(self, other: datetime)
__le__
__le__(self, other: datetime)
__gt__
__gt__(self, other: datetime)
__ge__
__ge__(self, other: datetime)
__bool__
__bool__(self)