This is a preview version of the DisplayLink DL-7450 Software Development Kit Documentation. The functionality that is described and made available in this version is subject to addition, removal or change without warning.

class date – Represent a date

date objects support equality and comparison operators.

class datetime.date(year, month, day)

All arguments are required. Arguments must be integers, in the following ranges:

  • MINYEAR <= year <= MAXYEAR

  • 1 <= month <= 12

  • 1 <= day <= number of days in the given month and year

Other constructors:

classmethod today()
classmethod fromtimestamp(timestamp)
classmethod fromordinal(ordinal)
classmethod fromisoformate(date_string)

Class attributes:

min

The earliest representable date, date(MINYEAR, 1, 1).

max

The latest representable date, date(MAXYEAR, 12, 31).

resolution

The smallest possible difference between non-equal date objects, timedelta(days=1) .

Instance attributes:

year
month
day

Instance methods

replace(year=self.year, month=self.month, day=self.day)

Return a new date object with the same values but the specified parameters updated.

tuple()

Return the date as a tuple (year, month, day)

timetuple()

Return the date as a 9-tuple

toordinal()

Return an integer representing the ordinal of the date, where January 1st of year 1 has ordinal 1.

isoformat()

Return a string representing the date in ISO 8601 format, YYYY-MM-DD:

from datetime import date
date(2002, 12, 4).isoformat()
# outputs '2002-12-04'
isoweekday()

Return the day of the week as an integer, where Monday is 1 and Sunday is 7.

weekday()

Return the day of the week as an integer, where Monday is 0 and Sunday is 6.