<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="date-and-time-literals">
      </a>
      11.1.3 Date and Time Literals
     </h3>
    </div>
   </div>
  </div>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="date-and-time-literals.html#date-and-time-standard-sql-literals" title="Standard SQL and ODBC Date and Time Literals">
       Standard SQL and ODBC Date and Time Literals
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="date-and-time-literals.html#date-and-time-string-numeric-literals" title="String and Numeric Literals in Date and Time Context">
       String and Numeric Literals in Date and Time Context
      </a>
     </p>
    </li>
   </ul>
  </div>
  <a class="indexterm" name="idm46045220420224">
  </a>
  <a class="indexterm" name="idm46045220418736">
  </a>
  <a class="indexterm" name="idm46045220417248">
  </a>
  <a class="indexterm" name="idm46045220416176">
  </a>
  <p>
   Date and time values can be represented in several formats, such
        as quoted strings or as numbers, depending on the exact type of
        the value and other factors. For example, in contexts where
        MySQL expects a date, it interprets any of
   <code class="literal">
    '2015-07-21'
   </code>
   ,
   <code class="literal">
    '20150721'
   </code>
   ,
        and
   <code class="literal">
    20150721
   </code>
   as a date.
  </p>
  <p>
   This section describes the acceptable formats for date and time
        literals. For more information about the temporal data types,
        such as the range of permitted values, see
   <a class="xref" href="date-and-time-types.html" title="13.2 Date and Time Data Types">
    Section 13.2, “Date and Time Data Types”
   </a>
   .
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="date-and-time-standard-sql-literals">
       </a>
       Standard SQL and ODBC Date and Time Literals
      </h4>
     </div>
    </div>
   </div>
   <p>
    Standard SQL requires temporal literals to be specified using
          a type keyword and a string. The space between the keyword and
          string is optional.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23130090"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token datatype">DATE</span> <span class="token string">'<em class="replaceable">str</em>'</span>
<span class="token datatype">TIME</span> <span class="token string">'<em class="replaceable">str</em>'</span>
<span class="token datatype">TIMESTAMP</span> <span class="token string">'<em class="replaceable">str</em>'</span></code></pre>
   </div>
   <p>
    MySQL recognizes but, unlike standard SQL, does not require
          the type keyword. Applications that are to be
          standard-compliant should include the type keyword for
          temporal literals.
   </p>
   <p>
    MySQL also recognizes the ODBC syntax corresponding to the
          standard SQL syntax:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-clike"><div class="docs-select-all right" id="sa32623545"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike"><span class="token punctuation">{</span> d <span class="token string">'<em class="replaceable">str</em>'</span> <span class="token punctuation">}</span>
<span class="token punctuation">{</span> t <span class="token string">'<em class="replaceable">str</em>'</span> <span class="token punctuation">}</span>
<span class="token punctuation">{</span> ts <span class="token string">'<em class="replaceable">str</em>'</span> <span class="token punctuation">}</span></code></pre>
   </div>
   <p>
    MySQL uses the type keywords and the ODBC constructions to
          produce
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATE
     </code>
    </a>
    ,
    <a class="link" href="time.html" title="13.2.3 The TIME Type">
     <code class="literal">
      TIME
     </code>
    </a>
    , and
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    values, respectively,
          including a trailing fractional seconds part if specified. The
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    syntax produces a
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    value in MySQL because
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    has a range that more
          closely corresponds to the standard SQL
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    type, which has a
          year range from
    <code class="literal">
     0001
    </code>
    to
    <code class="literal">
     9999
    </code>
    . (The MySQL
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    year range is
    <code class="literal">
     1970
    </code>
    to
    <code class="literal">
     2038
    </code>
    .)
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="date-and-time-string-numeric-literals">
       </a>
       String and Numeric Literals in Date and Time Context
      </h4>
     </div>
    </div>
   </div>
   <p>
    MySQL recognizes
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATE
     </code>
    </a>
    values in
          these formats:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       As a string in either
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYYY-MM-DD
         </code>
        </em>
        '
       </code>
       or
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YY-MM-DD
         </code>
        </em>
        '
       </code>
       format. A
       <span class="quote">
        “
        <span class="quote">
         relaxed
        </span>
        ”
       </span>
       syntax is permitted, but
              is deprecated: Any punctuation character may be used as
              the delimiter between date parts. For example,
       <code class="literal">
        '2012-12-31'
       </code>
       ,
       <code class="literal">
        '2012/12/31'
       </code>
       ,
       <code class="literal">
        '2012^12^31'
       </code>
       , and
       <code class="literal">
        '2012@12@31'
       </code>
       are equivalent. Using any
              character other than the dash (
       <code class="literal">
        -
       </code>
       ) as
              the delimiter raises a warning, as shown here:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92783362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">DATE</span><span class="token string">'2012@12@31'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> DATE'2012@12@31' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
  Level<span class="token punctuation">:</span> Warning
   Code<span class="token punctuation">:</span> 4095
Message<span class="token punctuation">:</span> Delimiter '@' in position 4 in datetime value '2012@12@31' at row 1 is
deprecated. Prefer the standard '-'. 
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       As a string with no delimiters in either
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYYYMMDD
         </code>
        </em>
        '
       </code>
       or
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYMMDD
         </code>
        </em>
        '
       </code>
       format, provided that the string makes sense as a date.
              For example,
       <code class="literal">
        '20070523'
       </code>
       and
       <code class="literal">
        '070523'
       </code>
       are interpreted as
       <code class="literal">
        '2007-05-23'
       </code>
       , but
       <code class="literal">
        '071332'
       </code>
       is illegal (it has nonsensical
              month and day parts) and becomes
       <code class="literal">
        '0000-00-00'
       </code>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       As a number in either
       <em class="replaceable">
        <code>
         YYYYMMDD
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         YYMMDD
        </code>
       </em>
       format, provided that
              the number makes sense as a date. For example,
       <code class="literal">
        19830905
       </code>
       and
       <code class="literal">
        830905
       </code>
       are interpreted as
       <code class="literal">
        '1983-09-05'
       </code>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    MySQL recognizes
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    and
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    values in these
          formats:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       As a string in either
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYYY-MM-DD
              hh:mm:ss
         </code>
        </em>
        '
       </code>
       or
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YY-MM-DD
              hh:mm:ss
         </code>
        </em>
        '
       </code>
       format. MySQL also
              permits a
       <span class="quote">
        “
        <span class="quote">
         relaxed
        </span>
        ”
       </span>
       syntax here, although
              this is deprecated: Any punctuation character may be used
              as the delimiter between date parts or time parts. For
              example,
       <code class="literal">
        '2012-12-31 11:30:45'
       </code>
       ,
       <code class="literal">
        '2012^12^31 11+30+45'
       </code>
       ,
       <code class="literal">
        '2012/12/31 11*30*45'
       </code>
       , and
       <code class="literal">
        '2012@12@31 11^30^45'
       </code>
       are equivalent.
              Use of any characters as delimiters in such values, other
              than the dash (
       <code class="literal">
        -
       </code>
       ) for the date part and
              the colon (
       <code class="literal">
        :
       </code>
       ) for the time part, raises
              a warning, as shown here:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82301229"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2012^12^31 11*30*45'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMESTAMP'2012^12^31 11*30*45' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
  Level<span class="token punctuation">:</span> Warning
   Code<span class="token punctuation">:</span> 4095
Message<span class="token punctuation">:</span> Delimiter '^' in position 4 in datetime value '2012^12^31 11<span class="token punctuation">*</span>30<span class="token punctuation">*</span>45' at
row 1 is deprecated. Prefer the standard '-'. 
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
      <p>
       The only delimiter recognized between a date and time part
              and a fractional seconds part is the decimal point.
      </p>
      <p>
       The date and time parts can be separated by
       <code class="literal">
        T
       </code>
       rather than a space. For example,
       <code class="literal">
        '2012-12-31 11:30:45'
       </code>
       <code class="literal">
        '2012-12-31T11:30:45'
       </code>
       are equivalent.
      </p>
      <p>
       Previously, MySQL supported arbitrary numbers of leading
              and trailing whitespace characters in date and time
              values, as well as between the date and time parts of
       <code class="literal">
        DATETIME
       </code>
       and
       <code class="literal">
        TIMESTAMP
       </code>
       values. In MySQL
              8.4, this behavior is deprecated, and the
              presence of excess whitespace characters triggers a
              warning, as shown here:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13851156"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2012-12-31   11-30-45'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMESTAMP'2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31   11<span class="token punctuation">-</span>30<span class="token punctuation">-</span>45' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45              <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
  Level<span class="token punctuation">:</span> Warning
   Code<span class="token punctuation">:</span> 4096
Message<span class="token punctuation">:</span> Delimiter ' ' in position 11 in datetime value '2012-12-31   11-30-45'
at row 1 is superfluous and is deprecated. Please remove. 
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
      <p>
       A warning is also raised when whitespace characters other
              than the space character is used, like this:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1825821"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2021-06-06
    '</span><span class="token operator">&gt;</span> <span class="token number">11</span>:<span class="token number">15</span>:<span class="token number">25</span><span class="token string">';
+--------------------------------+
| TIMESTAMP'</span><span class="token number">2021</span><span class="token operator">-</span><span class="token number">06</span><span class="token operator">-</span><span class="token number">06</span>
 <span class="token number">11</span>:<span class="token number">15</span>:<span class="token number">25</span><span class="token string">'                       |
+--------------------------------+
| 2021-06-06 11:15:25            |
+--------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql&gt; SHOW WARNINGS\G
*************************** 1. row ***************************
  Level: Warning
   Code: 4095
Message: Delimiter '</span>\n<span class="token string">' in position 10 in datetime value '</span><span class="token number">2021</span><span class="token operator">-</span><span class="token number">06</span><span class="token operator">-</span><span class="token number">06</span>
<span class="token number">11</span>:<span class="token number">15</span>:<span class="token number">25</span><span class="token string">' at row 1 is deprecated. Prefer the standard '</span> '<span class="token punctuation">.</span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
      <p>
       Only one such warning is raised per temporal value, even
              though multiple issues may exist with delimiters,
              whitespace, or both, as shown in the following series of
              statements:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1582851"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2012!-12-31  11:30:45'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMESTAMP'2012!<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31  11:30:45' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45              <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
  Level<span class="token punctuation">:</span> Warning
   Code<span class="token punctuation">:</span> 4095
Message<span class="token punctuation">:</span> Delimiter '!' in position 4 in datetime value '2012!-12-31  11<span class="token punctuation">:</span>30<span class="token punctuation">:</span>45'
at row 1 is deprecated. Prefer the standard '-'. 
</span><span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2012-12-31  11:30:45'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMESTAMP'2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31  11:30:45' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45             <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
  Level<span class="token punctuation">:</span> Warning
   Code<span class="token punctuation">:</span> 4096
Message<span class="token punctuation">:</span> Delimiter ' ' in position 11 in datetime value '2012-12-31  11<span class="token punctuation">:</span>30<span class="token punctuation">:</span>45'
at row 1 is superfluous and is deprecated. Please remove. 
</span><span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">TIMESTAMP</span><span class="token string">'2012-12-31 11:30:45'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMESTAMP'2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2012<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 11:30:45            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       As a string with no delimiters in either
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYYYMMDDhhmmss
         </code>
        </em>
        '
       </code>
       or
       <code class="literal">
        '
        <em class="replaceable">
         <code>
          YYMMDDhhmmss
         </code>
        </em>
        '
       </code>
       format, provided that the string makes sense as a date.
              For example,
       <code class="literal">
        '20070523091528'
       </code>
       and
       <code class="literal">
        '070523091528'
       </code>
       are interpreted as
       <code class="literal">
        '2007-05-23 09:15:28'
       </code>
       , but
       <code class="literal">
        '071122129015'
       </code>
       is illegal (it has a
              nonsensical minute part) and becomes
       <code class="literal">
        '0000-00-00
              00:00:00'
       </code>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       As a number in either
       <em class="replaceable">
        <code>
         YYYYMMDDhhmmss
        </code>
       </em>
       or
       <em class="replaceable">
        <code>
         YYMMDDhhmmss
        </code>
       </em>
       format, provided
              that the number makes sense as a date. For example,
       <code class="literal">
        19830905132800
       </code>
       and
       <code class="literal">
        830905132800
       </code>
       are interpreted as
       <code class="literal">
        '1983-09-05 13:28:00'
       </code>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    A
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    or
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    value can include a
          trailing fractional seconds part in up to microseconds (6
          digits) precision. The fractional part should always be
          separated from the rest of the time by a decimal point; no
          other fractional seconds delimiter is recognized. For
          information about fractional seconds support in MySQL, see
    <a class="xref" href="fractional-seconds.html" title="13.2.6 Fractional Seconds in Time Values">
     Section 13.2.6, “Fractional Seconds in Time Values”
    </a>
    .
   </p>
   <p>
    Dates containing two-digit year values are ambiguous because
          the century is unknown. MySQL interprets two-digit year values
          using these rules:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Year values in the range
       <code class="literal">
        70-99
       </code>
       become
       <code class="literal">
        1970-1999
       </code>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       Year values in the range
       <code class="literal">
        00-69
       </code>
       become
       <code class="literal">
        2000-2069
       </code>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    See also
    <a class="xref" href="two-digit-years.html" title="13.2.9 2-Digit Years in Dates">
     Section 13.2.9, “2-Digit Years in Dates”
    </a>
    .
   </p>
   <p>
    For values specified as strings that include date part
          delimiters, it is unnecessary to specify two digits for month
          or day values that are less than
    <code class="literal">
     10
    </code>
    .
    <code class="literal">
     '2015-6-9'
    </code>
    is the same as
    <code class="literal">
     '2015-06-09'
    </code>
    . Similarly, for values
          specified as strings that include time part delimiters, it is
          unnecessary to specify two digits for hour, minute, or second
          values that are less than
    <code class="literal">
     10
    </code>
    .
    <code class="literal">
     '2015-10-30 1:2:3'
    </code>
    is the same as
    <code class="literal">
     '2015-10-30 01:02:03'
    </code>
    .
   </p>
   <p>
    Values specified as numbers should be 6, 8, 12, or 14 digits
          long. If a number is 8 or 14 digits long, it is assumed to be
          in
    <em class="replaceable">
     <code>
      YYYYMMDD
     </code>
    </em>
    or
    <em class="replaceable">
     <code>
      YYYYMMDDhhmmss
     </code>
    </em>
    format and that the
          year is given by the first 4 digits. If the number is 6 or 12
          digits long, it is assumed to be in
    <em class="replaceable">
     <code>
      YYMMDD
     </code>
    </em>
    or
    <em class="replaceable">
     <code>
      YYMMDDhhmmss
     </code>
    </em>
    format and that the
          year is given by the first 2 digits. Numbers that are not one
          of these lengths are interpreted as though padded with leading
          zeros to the closest length.
   </p>
   <a class="indexterm" name="idm46045220301904">
   </a>
   <a class="indexterm" name="idm46045220300832">
   </a>
   <p>
    Values specified as nondelimited strings are interpreted
          according their length. For a string 8 or 14 characters long,
          the year is assumed to be given by the first 4 characters.
          Otherwise, the year is assumed to be given by the first 2
          characters. The string is interpreted from left to right to
          find year, month, day, hour, minute, and second values, for as
          many parts as are present in the string. This means you should
          not use strings that have fewer than 6 characters. For
          example, if you specify
    <code class="literal">
     '9903'
    </code>
    , thinking
          that represents March, 1999, MySQL converts it to the
    <span class="quote">
     “
     <span class="quote">
      zero
     </span>
     ”
    </span>
    date value. This occurs because the year
          and month values are
    <code class="literal">
     99
    </code>
    and
    <code class="literal">
     03
    </code>
    , but the day part is completely missing.
          However, you can explicitly specify a value of zero to
          represent missing month or day parts. For example, to insert
          the value
    <code class="literal">
     '1999-03-00'
    </code>
    , use
    <code class="literal">
     '990300'
    </code>
    .
   </p>
   <p>
    MySQL recognizes
    <a class="link" href="time.html" title="13.2.3 The TIME Type">
     <code class="literal">
      TIME
     </code>
    </a>
    values in
          these formats:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       As a string in
       <em class="replaceable">
        <code>
         'D hh:mm:ss'
        </code>
       </em>
       format. You can also use one of the following
       <span class="quote">
        “
        <span class="quote">
         relaxed
        </span>
        ”
       </span>
       syntaxes:
       <em class="replaceable">
        <code>
         'hh:mm:ss'
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         'hh:mm'
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         'D
              hh:mm'
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         'D hh'
        </code>
       </em>
       ,
              or
       <em class="replaceable">
        <code>
         'ss'
        </code>
       </em>
       . Here
       <em class="replaceable">
        <code>
         D
        </code>
       </em>
       represents days and can have
              a value from 0 to 34.
      </p>
     </li>
     <li class="listitem">
      <p>
       As a string with no delimiters in
       <em class="replaceable">
        <code>
         'hhmmss'
        </code>
       </em>
       format, provided that
              it makes sense as a time. For example,
       <code class="literal">
        '101112'
       </code>
       is understood as
       <code class="literal">
        '10:11:12'
       </code>
       , but
       <code class="literal">
        '109712'
       </code>
       is illegal (it has a
              nonsensical minute part) and becomes
       <code class="literal">
        '00:00:00'
       </code>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       As a number in
       <em class="replaceable">
        <code>
         hhmmss
        </code>
       </em>
       format,
              provided that it makes sense as a time. For example,
       <code class="literal">
        101112
       </code>
       is understood as
       <code class="literal">
        '10:11:12'
       </code>
       . The following alternative
              formats are also understood:
       <em class="replaceable">
        <code>
         ss
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         mmss
        </code>
       </em>
       , or
       <em class="replaceable">
        <code>
         hhmmss
        </code>
       </em>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    A trailing fractional seconds part is recognized in the
    <em class="replaceable">
     <code>
      'D hh:mm:ss.fraction'
     </code>
    </em>
    ,
    <em class="replaceable">
     <code>
      'hh:mm:ss.fraction'
     </code>
    </em>
    ,
    <em class="replaceable">
     <code>
      'hhmmss.fraction'
     </code>
    </em>
    , and
    <em class="replaceable">
     <code>
      hhmmss.fraction
     </code>
    </em>
    time formats, where
    <code class="literal">
     fraction
    </code>
    is the fractional part in up to
          microseconds (6 digits) precision. The fractional part should
          always be separated from the rest of the time by a decimal
          point; no other fractional seconds delimiter is recognized.
          For information about fractional seconds support in MySQL, see
    <a class="xref" href="fractional-seconds.html" title="13.2.6 Fractional Seconds in Time Values">
     Section 13.2.6, “Fractional Seconds in Time Values”
    </a>
    .
   </p>
   <p>
    For
    <a class="link" href="time.html" title="13.2.3 The TIME Type">
     <code class="literal">
      TIME
     </code>
    </a>
    values specified as
          strings that include a time part delimiter, it is unnecessary
          to specify two digits for hours, minutes, or seconds values
          that are less than
    <code class="literal">
     10
    </code>
    .
    <code class="literal">
     '8:3:2'
    </code>
    is the same as
    <code class="literal">
     '08:03:02'
    </code>
    .
   </p>
   <p>
    You can specify a time zone offset when inserting
    <code class="literal">
     TIMESTAMP
    </code>
    and
    <code class="literal">
     DATETIME
    </code>
    values into a table. The offset is appended to the time part
          of a datetime literal, with no intravening spaces, and uses
          the same format used for setting the
    <a class="link" href="server-system-variables.html#sysvar_time_zone">
     <code class="literal">
      time_zone
     </code>
    </a>
    system variable,
          with the following exceptions:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       For hour values less than 10, a leading zero is required.
      </p>
     </li>
     <li class="listitem">
      <p>
       The value
       <code class="literal">
        '-00:00'
       </code>
       is rejected.
      </p>
     </li>
     <li class="listitem">
      <p>
       Time zone names such as
       <code class="literal">
        'EET'
       </code>
       and
       <code class="literal">
        'Asia/Shanghai'
       </code>
       cannot be used;
       <code class="literal">
        'SYSTEM'
       </code>
       also cannot be used in this
              context.
      </p>
     </li>
    </ul>
   </div>
   <p>
    The value inserted must not have a zero for the month part,
          the day part, or both parts. This is enforced regardless of
          the server SQL mode setting.
   </p>
   <p>
    This example illustrates inserting datetime values with time
          zone offsets into
    <code class="literal">
     TIMESTAMP
    </code>
    and
    <code class="literal">
     DATETIME
    </code>
    columns using different
    <a class="link" href="server-system-variables.html#sysvar_time_zone">
     <code class="literal">
      time_zone
     </code>
    </a>
    settings, and then
          retrieving them:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77123652"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> ts <span class="token punctuation">(</span>
<span class="token prompt">    -&gt;</span>     id <span class="token datatype">INTEGER</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     col <span class="token datatype">TIMESTAMP</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token prompt">    -&gt;</span> <span class="token punctuation">)</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> dt <span class="token punctuation">(</span>
<span class="token prompt">    -&gt;</span>     id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     col <span class="token datatype">DATETIME</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token prompt">    -&gt;</span> <span class="token punctuation">)</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@@time_zone</span> <span class="token operator">=</span> <span class="token string">'SYSTEM'</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> ts <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10+05:30'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10-08:00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@@time_zone</span> <span class="token operator">=</span> <span class="token string">'+00:00'</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> ts <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10+05:30'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10-08:00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@@time_zone</span> <span class="token operator">=</span> <span class="token string">'SYSTEM'</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> dt <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10+05:30'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10-08:00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@@time_zone</span> <span class="token operator">=</span> <span class="token string">'+00:00'</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> dt <span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>     <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10+05:30'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token string">'2020-01-01 10:10:10-08:00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token variable">@@time_zone</span> <span class="token operator">=</span> <span class="token string">'SYSTEM'</span><span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@@system_time_zone</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @@system_time_zone <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> EST                <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> col<span class="token punctuation">,</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">FROM</span> dt <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> col                 <span class="token punctuation">|</span> UNIX_TIMESTAMP(col) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 10:10:10 <span class="token punctuation">|</span>          1577891410 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2019<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 23:40:10 <span class="token punctuation">|</span>          1577853610 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 13:10:10 <span class="token punctuation">|</span>          1577902210 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 10:10:10 <span class="token punctuation">|</span>          1577891410 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 04:40:10 <span class="token punctuation">|</span>          1577871610 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 18:10:10 <span class="token punctuation">|</span>          1577920210 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> col<span class="token punctuation">,</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span>col<span class="token punctuation">)</span> <span class="token keyword">FROM</span> ts <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> col                 <span class="token punctuation">|</span> UNIX_TIMESTAMP(col) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 10:10:10 <span class="token punctuation">|</span>          1577891410 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2019<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 23:40:10 <span class="token punctuation">|</span>          1577853610 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 13:10:10 <span class="token punctuation">|</span>          1577902210 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 05:10:10 <span class="token punctuation">|</span>          1577873410 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2019<span class="token punctuation">-</span>12<span class="token punctuation">-</span>31 23:40:10 <span class="token punctuation">|</span>          1577853610 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>01<span class="token punctuation">-</span>01 13:10:10 <span class="token punctuation">|</span>          1577902210 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
   </div>
   <p>
    The offset is not displayed when selecting a datetime value,
          even if one was used when inserting it.
   </p>
   <p>
    The range of supported offset values is
    <code class="literal">
     -13:59
    </code>
    to
    <code class="literal">
     +14:00
    </code>
    ,
          inclusive.
   </p>
   <p>
    Datetime literals that include time zone offsets are accepted
          as parameter values by prepared statements.
   </p>
  </div>
 </div>
 <br/>
</div>
