gooderp18绿色标准版
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

109 rindas
7.5KB

  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.6. History of Units</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 V1.79.1" /><link rel="prev" href="datetime-posix-timezone-specs.html" title="B.5. POSIX Time Zone Specifications" /><link rel="next" href="sql-keywords-appendix.html" title="Appendix C. SQL Key Words" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">B.6. History of Units</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="datetime-posix-timezone-specs.html" title="B.5. POSIX Time Zone Specifications">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 12.4 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></hr></div><div class="sect1" id="DATETIME-UNITS-HISTORY"><div class="titlepage"><div><div><h2 class="title" style="clear: both">B.6. History of Units</h2></div></div></div><a id="id-1.11.3.9.2" class="indexterm"></a><a id="id-1.11.3.9.3" class="indexterm"></a><p>
  3. The SQL standard states that <span class="quote">“<span class="quote">Within the definition of a
  4. <span class="quote">‘<span class="quote">datetime literal</span>’</span>, the <span class="quote">‘<span class="quote">datetime
  5. values</span>’</span> are constrained by the natural rules for dates and
  6. times according to the Gregorian calendar</span>”</span>.
  7. <span class="productname">PostgreSQL</span> follows the SQL
  8. standard's lead by counting dates exclusively in the Gregorian
  9. calendar, even for years before that calendar was in use.
  10. This rule is known as the <em class="firstterm">proleptic Gregorian calendar</em>.
  11. </p><p>
  12. The Julian calendar was introduced by Julius Caesar in 45 BC.
  13. It was in common use in the Western world
  14. until the year 1582, when countries started changing to the Gregorian
  15. calendar. In the Julian calendar, the tropical year is
  16. approximated as 365 1/4 days = 365.25 days. This gives an error of
  17. about 1 day in 128 years.
  18. </p><p>
  19. The accumulating calendar error prompted
  20. Pope Gregory XIII to reform the calendar in accordance with
  21. instructions from the Council of Trent.
  22. In the Gregorian calendar, the tropical year is approximated as
  23. 365 + 97 / 400 days = 365.2425 days. Thus it takes approximately 3300
  24. years for the tropical year to shift one day with respect to the
  25. Gregorian calendar.
  26. </p><p>
  27. The approximation 365+97/400 is achieved by having 97 leap years
  28. every 400 years, using the following rules:
  29. </p><table border="0" summary="Simple list" class="simplelist"><tr><td>
  30. Every year divisible by 4 is a leap year.
  31. </td></tr><tr><td>
  32. However, every year divisible by 100 is not a leap year.
  33. </td></tr><tr><td>
  34. However, every year divisible by 400 is a leap year after all.
  35. </td></tr></table><p>
  36. So, 1700, 1800, 1900, 2100, and 2200 are not leap years. But 1600,
  37. 2000, and 2400 are leap years.
  38. By contrast, in the older Julian calendar all years divisible by 4 are leap
  39. years.
  40. </p><p>
  41. The papal bull of February 1582 decreed that 10 days should be dropped
  42. from October 1582 so that 15 October should follow immediately after
  43. 4 October.
  44. This was observed in Italy, Poland, Portugal, and Spain. Other Catholic
  45. countries followed shortly after, but Protestant countries were
  46. reluctant to change, and the Greek Orthodox countries didn't change
  47. until the start of the 20th century.
  48. The reform was observed by Great Britain and its dominions (including what
  49. is now the USA) in 1752.
  50. Thus 2 September 1752 was followed by 14 September 1752.
  51. This is why Unix systems that have the <code class="command">cal</code> program
  52. produce the following:
  53. </p><pre class="screen">
  54. $ <strong class="userinput"><code>cal 9 1752</code></strong>
  55. September 1752
  56. S M Tu W Th F S
  57. 1 2 14 15 16
  58. 17 18 19 20 21 22 23
  59. 24 25 26 27 28 29 30
  60. </pre><p>
  61. But, of course, this calendar is only valid for Great Britain and
  62. dominions, not other places.
  63. Since it would be difficult and confusing to try to track the actual
  64. calendars that were in use in various places at various times,
  65. <span class="productname">PostgreSQL</span> does not try, but rather follows the Gregorian
  66. calendar rules for all dates, even though this method is not historically
  67. accurate.
  68. </p><p>
  69. Different calendars have been developed in various parts of the
  70. world, many predating the Gregorian system.
  71. For example,
  72. the beginnings of the Chinese calendar can be traced back to the 14th
  73. century BC. Legend has it that the Emperor Huangdi invented that
  74. calendar in 2637 BC.
  75. The People's Republic of China uses the Gregorian calendar
  76. for civil purposes. The Chinese calendar is used for determining
  77. festivals.
  78. </p><p>
  79. The <em class="firstterm">Julian Date</em> system is another type of
  80. calendar, unrelated to the Julian calendar though it is confusingly
  81. named similarly to that calendar.
  82. The Julian Date system was invented by the French scholar
  83. Joseph Justus Scaliger (1540-1609)
  84. and probably takes its name from Scaliger's father,
  85. the Italian scholar Julius Caesar Scaliger (1484-1558).
  86. In the Julian Date system, each day has a sequential number, starting
  87. from JD 0 (which is sometimes called <span class="emphasis"><em>the</em></span> Julian Date).
  88. JD 0 corresponds to 1 January 4713 BC in the Julian calendar, or
  89. 24 November 4714 BC in the Gregorian calendar. Julian Date counting
  90. is most often used by astronomers for labeling their nightly observations,
  91. and therefore a date runs from noon UTC to the next noon UTC, rather than
  92. from midnight to midnight: JD 0 designates the 24 hours from noon UTC on
  93. 24 November 4714 BC to noon UTC on 25 November 4714 BC.
  94. </p><p>
  95. Although <span class="productname">PostgreSQL</span> supports Julian Date notation for
  96. input and output of dates (and also uses Julian dates for some internal
  97. datetime calculations), it does not observe the nicety of having dates
  98. run from noon to noon. <span class="productname">PostgreSQL</span> treats a Julian Date
  99. as running from midnight to midnight.
  100. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="datetime-posix-timezone-specs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="datetime-appendix.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-keywords-appendix.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">B.5. <acronym class="acronym">POSIX</acronym> Time Zone Specifications </td><td width="20%" align="center"><a accesskey="h" href="index.html">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>
上海开阖软件有限公司 沪ICP备12045867号-1