DATE (calendar date)

Last updated: 2026-11-04

DATE (calendar date)

DATE represents a calendar date with no time and no time zone, ranging from 4713 BC to 5874897 AD and stored as a 4-byte Julian day count. Arithmetic reads naturally: date + 7 yields the date a week later, and date - date yields the number of days between them. Because it carries no time-of-day, DATE cannot express "a moment on a given day"; it fits birthdays and billing dates, while actual event instants belong in TIMESTAMP.

Kindtype
Example LanguageSQL

📝 Syntax

DATE  ——  calendar date, 4 bytes, 4713 BC to 5874897 AD

Returns:Stores a calendar date. Adding an integer yields a shifted date, subtracting two DATEs yields an integer number of days, and subtracting a TIMESTAMP yields a full interval.

▶ Example

Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.

Output:

 id |  born_on   | plus_30_days | days_since_2024 | col_type
----+------------+--------------+-----------------+----------
  1 | 1990-05-20 | 1990-06-19   |          -12279 | date
  2 | 2024-02-29 | 2024-03-30   |              59 | date

📌 Key Points

More case studies coming soon.

📚 Related Reference

❓ FAQ

QDATE or TIMESTAMP?
AUse DATE when only the calendar day matters, such as birthdays, billing periods or holidays. Use TIMESTAMP when the moment matters, such as order creation times or event triggers. DATE is smaller and simpler to compare.
QIs DATE affected by the time zone?
ANo. DATE is a pure calendar date, entirely independent of the session time zone. To normalise an instant to a local day, write it explicitly as (timestamptz AT TIME ZONE 'Asia/Shanghai')::date.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏