💾 Archived View for tris.fyi › pydoc › _datetime captured on 2022-06-11 at 21:34:04. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-04-28)

➡️ Next capture (2022-07-16)

-=-=-=-=-=-=-

Back to module index

Go to module by name

_datetime

Fast implementation of the datetime type.

Classes

date

date(year, month, day) --> date object
ctime(...)

  Return ctime() style string.
fromisocalendar(...)

  int, int, int -> Construct a date from the ISO year, week number and weekday.

  This is the inverse of the date.isocalendar() function
fromisoformat(...)

  str -> Construct a date from the output of date.isoformat()
fromordinal(...)

  int -> date corresponding to a proleptic Gregorian ordinal.
fromtimestamp(timestamp, /)

  Create a date from a POSIX timestamp.

  The timestamp is a number, e.g. created via time.time(), that is interpreted
  as local time.
isocalendar(...)

  Return a named tuple containing ISO year, week number, and weekday.
isoformat(...)

  Return string in ISO 8601 format, YYYY-MM-DD.
isoweekday(...)

  Return the day of the week represented by the date.
  Monday == 1 ... Sunday == 7
replace(...)

  Return date with new specified fields.
strftime(...)

  format -> strftime() style string.
timetuple(...)

  Return time tuple, compatible with time.localtime().
today(...)

  Current date or datetime:  same as self.__class__.fromtimestamp(time.time()).
toordinal(...)

  Return proleptic Gregorian ordinal.  January 1 of year 1 is day 1.
weekday(...)

  Return the day of the week represented by the date.
  Monday == 0 ... Sunday == 6
day = <attribute 'day' of 'datetime.date' objects>
max = datetime.date(9999, 12, 31)
min = datetime.date(1, 1, 1)
month = <attribute 'month' of 'datetime.date' objects>
resolution = datetime.timedelta(days=1)
year = <attribute 'year' of 'datetime.date' objects>

datetime

datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

The year, month and day arguments are required. tzinfo may be None, or an
instance of a tzinfo subclass. The remaining arguments may be ints.

astimezone(...)

  tz -> convert to local time in new timezone tz

combine(...)

  date, time -> datetime with same date and time fields
ctime(...)

  Return ctime() style string.
date(...)

  Return date object with same year, month and day.
dst(...)

  Return self.tzinfo.dst(self).
fromisocalendar(...)

  int, int, int -> Construct a date from the ISO year, week number and weekday.

  This is the inverse of the date.isocalendar() function
fromisoformat(...)

  string -> datetime from datetime.isoformat() output
fromordinal(...)

  int -> date corresponding to a proleptic Gregorian ordinal.
fromtimestamp(...)

  timestamp[, tz] -> tz's local time from POSIX timestamp.
isocalendar(...)

  Return a named tuple containing ISO year, week number, and weekday.
isoformat(...)

  [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].
  sep is used to separate the year from the time, and defaults to 'T'.
  The optional argument timespec specifies the number of additional terms
  of the time to include. Valid options are 'auto', 'hours', 'minutes',
  'seconds', 'milliseconds' and 'microseconds'.

isoweekday(...)

  Return the day of the week represented by the date.
  Monday == 1 ... Sunday == 7
now(tz=None)

  Returns new datetime object representing current time local to tz.

    tz
      Timezone object.

  If no tz is specified, uses local timezone.
replace(...)

  Return datetime with new specified fields.
strftime(...)

  format -> strftime() style string.
strptime(...)

  string, format -> new datetime parsed from a string (like time.strptime()).
time(...)

  Return time object with same time but with tzinfo=None.
timestamp(...)

  Return POSIX timestamp as float.
timetuple(...)

  Return time tuple, compatible with time.localtime().
timetz(...)

  Return time object with same time and tzinfo.
today(...)

  Current date or datetime:  same as self.__class__.fromtimestamp(time.time()).
toordinal(...)

  Return proleptic Gregorian ordinal.  January 1 of year 1 is day 1.
tzname(...)

  Return self.tzinfo.tzname(self).
utcfromtimestamp(...)

  Construct a naive UTC datetime from a POSIX timestamp.
utcnow(...)

  Return a new datetime representing UTC day and time.
utcoffset(...)

  Return self.tzinfo.utcoffset(self).
utctimetuple(...)

  Return UTC time tuple, compatible with time.localtime().
weekday(...)

  Return the day of the week represented by the date.
  Monday == 0 ... Sunday == 6
day = <attribute 'day' of 'datetime.date' objects>
fold = <attribute 'fold' of 'datetime.datetime' objects>
hour = <attribute 'hour' of 'datetime.datetime' objects>
max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
microsecond = <attribute 'microsecond' of 'datetime.datetime' objects>
min = datetime.datetime(1, 1, 1, 0, 0)
minute = <attribute 'minute' of 'datetime.datetime' objects>
month = <attribute 'month' of 'datetime.date' objects>
resolution = datetime.timedelta(microseconds=1)
second = <attribute 'second' of 'datetime.datetime' objects>
tzinfo = <attribute 'tzinfo' of 'datetime.datetime' objects>
year = <attribute 'year' of 'datetime.date' objects>

time

time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object

All arguments are optional. tzinfo may be None, or an instance of
a tzinfo subclass. The remaining arguments may be ints.

dst(...)

  Return self.tzinfo.dst(self).
fromisoformat(...)

  string -> time from time.isoformat() output
isoformat(...)

  Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].

  The optional argument timespec specifies the number of additional terms
  of the time to include. Valid options are 'auto', 'hours', 'minutes',
  'seconds', 'milliseconds' and 'microseconds'.

replace(...)

  Return time with new specified fields.
strftime(...)

  format -> strftime() style string.
tzname(...)

  Return self.tzinfo.tzname(self).
utcoffset(...)

  Return self.tzinfo.utcoffset(self).
fold = <attribute 'fold' of 'datetime.time' objects>
hour = <attribute 'hour' of 'datetime.time' objects>
max = datetime.time(23, 59, 59, 999999)
microsecond = <attribute 'microsecond' of 'datetime.time' objects>
min = datetime.time(0, 0)
minute = <attribute 'minute' of 'datetime.time' objects>
resolution = datetime.timedelta(microseconds=1)
second = <attribute 'second' of 'datetime.time' objects>
tzinfo = <attribute 'tzinfo' of 'datetime.time' objects>

timedelta

Difference between two datetime values.

timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)

All arguments are optional and default to 0.
Arguments may be integers or floats, and may be positive or negative.
total_seconds(...)

  Total seconds in the duration.
days = <member 'days' of 'datetime.timedelta' objects>
  Number of days.
max = datetime.timedelta(days=999999999, seconds=86399, microseconds=999999)
microseconds = <member 'microseconds' of 'datetime.timedelta' objects>
  Number of microseconds (>= 0 and less than 1 second).
min = datetime.timedelta(days=-999999999)
resolution = datetime.timedelta(microseconds=1)
seconds = <member 'seconds' of 'datetime.timedelta' objects>
  Number of seconds (>= 0 and less than 1 day).

timezone

Fixed offset from UTC implementation of tzinfo.
dst(...)

  Return None.
fromutc(...)

  datetime in UTC -> datetime in local time.
tzname(...)

  If name is specified when timezone is created, returns the name.  Otherwise returns offset as 'UTC(+|-)HH:MM'.
utcoffset(...)

  Return fixed offset.
max = datetime.timezone(datetime.timedelta(seconds=86340))
min = datetime.timezone(datetime.timedelta(days=-1, seconds=60))
utc = datetime.timezone.utc

tzinfo

Abstract base class for time zone info objects.
dst(...)

  datetime -> DST offset as timedelta positive east of UTC.
fromutc(...)

  datetime in UTC -> datetime in local time.
tzname(...)

  datetime -> string name of time zone.
utcoffset(...)

  datetime -> timedelta showing offset from UTC, negative values indicating West of UTC

Other members

MAXYEAR = 9999
MINYEAR = 1
datetime_CAPI = <capsule object "datetime.datetime_CAPI" at 0x7ff3607a7b70>