diff options
Diffstat (limited to 'doc/src/sgml/html/datetime-input-rules.html')
-rw-r--r-- | doc/src/sgml/html/datetime-input-rules.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/doc/src/sgml/html/datetime-input-rules.html b/doc/src/sgml/html/datetime-input-rules.html new file mode 100644 index 0000000..bf7d997 --- /dev/null +++ b/doc/src/sgml/html/datetime-input-rules.html @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!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.1. Date/Time Input Interpretation</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-appendix.html" title="Appendix B. Date/Time Support" /><link rel="next" href="datetime-invalid-input.html" title="B.2. Handling of Invalid or Ambiguous Timestamps" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">B.1. Date/Time Input Interpretation</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="datetime-appendix.html" title="Appendix B. Date/Time Support">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 13.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="datetime-invalid-input.html" title="B.2. Handling of Invalid or Ambiguous Timestamps">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="DATETIME-INPUT-RULES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">B.1. Date/Time Input Interpretation</h2></div></div></div><p> + Date/time input strings are decoded using the following procedure. + </p><div class="procedure"><ol class="procedure" type="1"><li class="step"><p> + Break the input string into tokens and categorize each token as + a string, time, time zone, or number. + </p><ol type="a" class="substeps"><li class="step"><p> + If the numeric token contains a colon (<code class="literal">:</code>), this is + a time string. Include all subsequent digits and colons. + </p></li><li class="step"><p> + If the numeric token contains a dash (<code class="literal">-</code>), slash + (<code class="literal">/</code>), or two or more dots (<code class="literal">.</code>), this is + a date string which might have a text month. If a date token has + already been seen, it is instead interpreted as a time zone + name (e.g., <code class="literal">America/New_York</code>). + </p></li><li class="step"><p> + If the token is numeric only, then it is either a single field + or an ISO 8601 concatenated date (e.g., + <code class="literal">19990113</code> for January 13, 1999) or time + (e.g., <code class="literal">141516</code> for 14:15:16). + </p></li><li class="step"><p> + If the token starts with a plus (<code class="literal">+</code>) or minus + (<code class="literal">-</code>), then it is either a numeric time zone or a special + field. + </p></li></ol></li><li class="step"><p> + If the token is an alphabetic string, match up with possible strings: + </p><ol type="a" class="substeps"><li class="step"><p> + See if the token matches any known time zone abbreviation. + These abbreviations are supplied by the configuration file + described in <a class="xref" href="datetime-config-files.html" title="B.4. Date/Time Configuration Files">Section B.4</a>. + </p></li><li class="step"><p> + If not found, search an internal table to match + the token as either a special string (e.g., <code class="literal">today</code>), + day (e.g., <code class="literal">Thursday</code>), + month (e.g., <code class="literal">January</code>), + or noise word (e.g., <code class="literal">at</code>, <code class="literal">on</code>). + </p></li><li class="step"><p> + If still not found, throw an error. + </p></li></ol></li><li class="step"><p> + When the token is a number or number field: + </p><ol type="a" class="substeps"><li class="step"><p> + If there are eight or six digits, + and if no other date fields have been previously read, then interpret + as a <span class="quote">“<span class="quote">concatenated date</span>”</span> (e.g., + <code class="literal">19990118</code> or <code class="literal">990118</code>). + The interpretation is <code class="literal">YYYYMMDD</code> or <code class="literal">YYMMDD</code>. + </p></li><li class="step"><p> + If the token is three digits + and a year has already been read, then interpret as day of year. + </p></li><li class="step"><p> + If four or six digits and a year has already been read, then + interpret as a time (<code class="literal">HHMM</code> or <code class="literal">HHMMSS</code>). + </p></li><li class="step"><p> + If three or more digits and no date fields have yet been found, + interpret as a year (this forces yy-mm-dd ordering of the remaining + date fields). + </p></li><li class="step"><p> + Otherwise the date field ordering is assumed to follow the + <code class="varname">DateStyle</code> setting: mm-dd-yy, dd-mm-yy, or yy-mm-dd. + Throw an error if a month or day field is found to be out of range. + </p></li></ol></li><li class="step"><p> + If BC has been specified, negate the year and add one for + internal storage. (There is no year zero in the Gregorian + calendar, so numerically 1 BC becomes year zero.) + </p></li><li class="step"><p> + If BC was not specified, and if the year field was two digits in length, + then adjust the year to four digits. If the field is less than 70, then + add 2000, otherwise add 1900. + + </p><div class="tip"><h3 class="title">Tip</h3><p> + Gregorian years AD 1–99 can be entered by using 4 digits with leading + zeros (e.g., <code class="literal">0099</code> is AD 99). + </p></div><p> + </p></li></ol></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="datetime-appendix.html" title="Appendix B. Date/Time Support">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="datetime-invalid-input.html" title="B.2. Handling of Invalid or Ambiguous Timestamps">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix B. Date/Time Support </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> B.2. Handling of Invalid or Ambiguous Timestamps</td></tr></table></div></body></html>
\ No newline at end of file |