<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Julian Dates</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.6.22 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Date/Time Support" HREF="datetime-appendix.html"><LINK REL="PREVIOUS" TITLE="History of Units" HREF="datetime-units-history.html"><LINK REL="NEXT" TITLE="SQL Key Words" HREF="sql-keywords-appendix.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2021-05-18T09:16:10"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.6.22 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="History of Units" HREF="datetime-units-history.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="datetime-appendix.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Appendix B. Date/Time Support</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="SQL Key Words" HREF="sql-keywords-appendix.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="DATETIME-JULIAN-DATES" >B.7. Julian Dates</A ></H1 ><P > The <I CLASS="FIRSTTERM" >Julian Date</I > system is a method for numbering days. It is unrelated to the Julian calendar, though it is confusingly named similarly to that calendar. The Julian Date system was invented by the French scholar Joseph Justus Scaliger (1540-1609) and probably takes its name from Scaliger's father, the Italian scholar Julius Caesar Scaliger (1484-1558). </P ><P > In the Julian Date system, each day has a sequential number, starting from JD 0 (which is sometimes called <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >the</I ></SPAN > Julian Date). JD 0 corresponds to 1 January 4713 BC in the Julian calendar, or 24 November 4714 BC in the Gregorian calendar. Julian Date counting is most often used by astronomers for labeling their nightly observations, and therefore a date runs from noon UTC to the next noon UTC, rather than from midnight to midnight: JD 0 designates the 24 hours from noon UTC on 24 November 4714 BC to noon UTC on 25 November 4714 BC. </P ><P > Although <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > supports Julian Date notation for input and output of dates (and also uses Julian dates for some internal datetime calculations), it does not observe the nicety of having dates run from noon to noon. <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > treats a Julian Date as running from local midnight to local midnight, the same as a normal date. </P ><P > This definition does, however, provide a way to obtain the astronomical definition when you need it: do the arithmetic in time zone <TT CLASS="LITERAL" >UTC+12</TT >. For example, </P><PRE CLASS="PROGRAMLISTING" >=> SELECT extract(julian from '2021-06-23 7:00:00-04'::timestamptz at time zone 'UTC+12'); date_part -------------------- 2459388.9583333335 (1 row) => SELECT extract(julian from '2021-06-23 8:00:00-04'::timestamptz at time zone 'UTC+12'); date_part ----------- 2459389 (1 row) => SELECT extract(julian from date '2021-06-23'); date_part ----------- 2459389 (1 row)</PRE ><P> </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="datetime-units-history.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="sql-keywords-appendix.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >History of Units</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="datetime-appendix.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><ACRONYM CLASS="ACRONYM" >SQL</ACRONYM > Key Words</TD ></TR ></TABLE ></DIV ></BODY ></HTML >