On this page
sqlite3.Date
Prev: sqlite3.DataError | Up: sqlite3 | Next: sqlite3.DateFromTicks
Rel: sqlite3.adapt, sqlite3.Binary, sqlite3.Blob, sqlite3.complete_statement
Ref: docs.python.org — sqlite3.Date
Tags: #public #python3 #stdlib #sqlite3
Import
import sqlite3
from sqlite3 import Date
Signature & Overview
sqlite3.Date(...)
date(year, month, day) --> date object
Methods & Attributes
Date.ctime(self, /)— Return ctime() style string.Date.fromisocalendar(...)— int, int, int -> Construct a date from the ISO year, week number and weekday.Date.fromisoformat(object, /)— str -> Construct a date from a string in ISO 8601 format.Date.fromordinal(...)— int -> date corresponding to a proleptic Gregorian ordinal.Date.fromtimestamp(timestamp, /)— Create a date from a POSIX timestamp.Date.isocalendar(self, /)— Return a named tuple containing ISO year, week number, and weekday.Date.isoformat(self, /)— Return string in ISO 8601 format, YYYY-MM-DD.Date.isoweekday(self, /)— Return the day of the week represented by the date.Date.replace(...)— Return date with new specified fields.Date.strftime(...)— format -> strftime() style string.Date.strptime(...)— string, format -> new date parsed from a string (like time.strptime()).Date.timetuple(self, /)— Return time tuple, compatible with time.localtime().Date.today()— Current date or datetime: same as self.class.fromtimestamp(time.time()).Date.toordinal(self, /)— Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.Date.weekday(self, /)— Return the day of the week represented by the date.
Usage
import datetime
import sqlite3
d = sqlite3.Date(2026, 12, 2)
assert d == datetime.date(2026, 12, 2)
Gotchas
- DB-API 2.0 alias for
datetime.date: Preferdatetime.datedirectly (and ISO-8601 strings in SQLite columns).
REPL Inspect
from sqlite3 import Date
help(Date)
Linked from
Related notes
- tuts/python3/stdlib_module/sqlite3 Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/DataError Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/DateFromTicks Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/adapt Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/Binary Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/Blob Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/complete_statement Linked here; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib