DATE
DATE holds a calendar day with no clock attached. It sounds like the simplest type in SQL, and every engine still manages to disagree about it.
- Family
- Dates & times
- Missing in
- None of the five
- Gotchas
- 5 listed
Engine by engine
A calendar date without a time-of-day. SQL Server and MySQL use 3 bytes with narrower ranges, PostgreSQL uses 4 bytes and reaches back to 4713 BC, and Oracle has no pure DATE at all.
| エンジン | 型 | ストレージ | メモ |
|---|---|---|---|
| SQL Server |
DATE
|
3 bytes | Range 0001-01-01 to 9999-12-31; added in SQL Server 2008, before that DATETIME carried dates. |
| PostgreSQL |
DATE
|
4 bytes | Range 4713 BC to 5874897 AD; accepts 'today', 'tomorrow' and 'infinity' as values. |
| MySQL |
DATE
|
3 bytes | Range 1000-01-01 to 9999-12-31; loose SQL mode turns invalid dates into '0000-00-00'. |
| SQLite |
TEXT
|
variable | No native DATE. Store ISO-8601 text like '2026-02-14' and use the date() and strftime() functions. |
| Oracle |
DATE
|
7 bytes | Not a pure date: an Oracle DATE always carries a time component, defaulting to 00:00:00. |
Gotchas
Where the engines disagree. These tend to surface as bugs during a migration or a port.
- Oracle's DATE is not date-only. It always stores century through seconds (7 bytes), so DATE '2026-02-14' is really 2026-02-14 00:00:00, and subtracting two DATEs yields a number of days, not a date.
- SQLite has no DATE type. A column declared DATE gets NUMERIC affinity, so '2026-02-14' stays text and 20260214 stays an integer; every date operation goes through date functions or string comparison.
- MySQL's DATE range starts at 1000-01-01, and with strict mode off, invalid input silently becomes the zero date '0000-00-00' instead of an error.
- SQL Server only gained DATE in 2008. Older code ships dates inside DATETIME, rounding every value to a 3.33-millisecond grid you did not ask for.
- PostgreSQL accepts 'infinity' and '-infinity' as DATE values, which sorts above and below every real date - handy for sentinels, surprising in exports.
Common questions
How many bytes does DATE use?
SQL Server and MySQL store a DATE in 3 bytes, PostgreSQL in 4, and Oracle's DATE in 7 because it includes a time. SQLite stores whatever representation you chose, usually text.
Does DATE include a time zone?
No. DATE is a calendar day with no time and no zone. Time-zone handling belongs to TIMESTAMPTZ or DATETIMEOFFSET.
Why does my Oracle DATE show a time?
Because Oracle DATE always stores one. NLS_DATE_FORMAT often hides it, so WHERE d = DATE '2026-02-14' silently misses rows whose time is not midnight; compare a range or use TRUNC(d).
Related on SQLly
- SQL data type comparison and converter Free tool
- Get the first day of the month in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- Add days to a date in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- Get the last day of the month in SQL Server, PostgreSQL, MySQL, SQLite and Oracle Dialect comparison
- SQL DATE() function 関数
- SQL date literal 関数
Map a type to the other four engines
The free type converter maps a type from one engine to its closest equivalent in the others and says where storage, precision or behaviour differ. The desktop app does the same mapping while you edit.