]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/datetime-julian-dates.html
PG 18 docs from https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0-docs...
[ai-pg] / full-docs / src / sgml / html / datetime-julian-dates.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>B.7. Julian Dates</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="datetime-units-history.html" title="B.6. History of Units" /><link rel="next" href="sql-keywords-appendix.html" title="Appendix C. SQL Key Words" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">B.7. Julian Dates</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="datetime-units-history.html" title="B.6. History of Units">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="datetime-appendix.html" title="Appendix B. Date/Time Support">Up</a></td><th width="60%" align="center">Appendix B. Date/Time Support</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-keywords-appendix.html" title="Appendix C. SQL Key Words">Next</a></td></tr></table><hr /></div><div class="sect1" id="DATETIME-JULIAN-DATES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">B.7. Julian Dates <a href="#DATETIME-JULIAN-DATES" class="id_link">#</a></h2></div></div></div><a id="id-1.11.3.10.2" class="indexterm"></a><p>
3    The <em class="firstterm">Julian Date</em> system is a method for
4    numbering days.  It is
5    unrelated to the Julian calendar, though it is confusingly
6    named similarly to that calendar.
7    The Julian Date system was invented by the French scholar
8    Joseph Justus Scaliger (1540–1609)
9    and probably takes its name from Scaliger's father,
10    the Italian scholar Julius Caesar Scaliger (1484–1558).
11   </p><p>
12    In the Julian Date system, each day has a sequential number, starting
13    from JD 0 (which is sometimes called <span class="emphasis"><em>the</em></span> Julian Date).
14    JD 0 corresponds to 1 January 4713 BC in the Julian calendar, or
15    24 November 4714 BC in the Gregorian calendar.  Julian Date counting
16    is most often used by astronomers for labeling their nightly observations,
17    and therefore a date runs from noon UTC to the next noon UTC, rather than
18    from midnight to midnight: JD 0 designates the 24 hours from noon UTC on
19    24 November 4714 BC to noon UTC on 25 November 4714 BC.
20   </p><p>
21    Although <span class="productname">PostgreSQL</span> supports Julian Date notation for
22    input and output of dates (and also uses Julian dates for some internal
23    datetime calculations), it does not observe the nicety of having dates
24    run from noon to noon.  <span class="productname">PostgreSQL</span> treats a Julian Date
25    as running from local midnight to local midnight, the same as a normal
26    date.
27   </p><p>
28    This definition does, however, provide a way to obtain the astronomical
29    definition when you need it: do the arithmetic in time
30    zone <code class="literal">UTC+12</code>.  For example,
31 </p><pre class="programlisting">
32 =&gt; SELECT extract(julian from '2021-06-23 7:00:00-04'::timestamptz at time zone 'UTC+12');
33            extract
34 ------------------------------
35  2459388.95833333333333333333
36 (1 row)
37 =&gt; SELECT extract(julian from '2021-06-23 8:00:00-04'::timestamptz at time zone 'UTC+12');
38                extract
39 --------------------------------------
40  2459389.0000000000000000000000000000
41 (1 row)
42 =&gt; SELECT extract(julian from date '2021-06-23');
43  extract
44 ---------
45  2459389
46 (1 row)
47 </pre><p>
48   </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="datetime-units-history.html" title="B.6. History of Units">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="datetime-appendix.html" title="Appendix B. Date/Time Support">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-keywords-appendix.html" title="Appendix C. SQL Key Words">Next</a></td></tr><tr><td width="40%" align="left" valign="top">B.6. History of Units </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Appendix C. <acronym class="acronym">SQL</acronym> Key Words</td></tr></table></div></body></html>