<replaceable>fields</replaceable> must include <literal>SECOND</literal>,
since the precision applies only to the seconds.
</para>
<para>
The type <type>time with time zone</type> is defined by the SQL
standard, but the definition exhibits properties which lead to
questionable usefulness. In most cases, a combination of
<type>date</type>, <type>time</type>, <type>timestamp without time
zone</type>, and <type>timestamp with time zone</type> should
provide a complete range of date/time functionality required by
any application.
</para>
<sect2 id="datatype-datetime-input">
<title>Date/Time Input</title>
<para>
Date and time input is accepted in almost any reasonable format, including
ISO 8601, <acronym>SQL</acronym>-compatible,
traditional <productname>POSTGRES</productname>, and others.
For some formats, ordering of day, month, and year in date input is
ambiguous and there is support for specifying the expected
ordering of these fields. Set the <xref linkend="guc-datestyle"/> parameter
to <literal>MDY</literal> to select month-day-year interpretation,
<literal>DMY</literal> to select day-month-year interpretation, or
<literal>YMD</literal> to select year-month-day interpretation.
</para>
<para>
<productname>PostgreSQL</productname> is more flexible in
handling date/time input than the
<acronym>SQL</acronym> standard requires.
See <xref linkend="datetime-appendix"/>
for the exact parsing rules of date/time input and for the
recognized text fields including months, days of the week, and
time zones.
</para>
<para>
Remember that any date or time literal input needs to be enclosed
in single quotes, like text strings. Refer to
<xref linkend="sql-syntax-constants-generic"/> for more
information.
<acronym>SQL</acronym> requires the following syntax
<synopsis>
<replaceable>type</replaceable> [ (<replaceable>p</replaceable>) ] '<replaceable>value</replaceable>'
</synopsis>
where <replaceable>p</replaceable> is an optional precision
specification giving the number of
fractional digits in the seconds field. Precision can be
specified for <type>time</type>, <type>timestamp</type>, and
<type>interval</type> types, and can range from 0 to 6.
If no precision is specified in a constant specification,
it defaults to the precision of the literal value (but not
more than 6 digits).
</para>
<sect3 id="datatype-datetime-input-dates">
<title>Dates</title>
<indexterm>
<primary>date</primary>
</indexterm>
<para>
<xref linkend="datatype-datetime-date-table"/> shows some possible
inputs for the <type>date</type> type.
</para>
<table id="datatype-datetime-date-table">
<title>Date Input</title>
<tgroup cols="2">
<colspec colname="col1" colwidth="1*"/>
<colspec colname="col2" colwidth="2*"/>
<thead>
<row>
<entry>Example</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>1999-01-08</entry>
<entry>ISO 8601; January 8 in any mode
(recommended format)</entry>
</row>
<row>
<entry>January 8, 1999</entry>
<entry>unambiguous in any <varname>datestyle</varname> input mode</entry>
</row>
<row>
<entry>1/8/1999</entry>
<entry>January 8 in <literal>MDY</literal> mode;
August 1 in <literal>DMY</literal> mode</entry>
</row>
<row>
<entry>1/18/1999</entry>
<entry>January 18 in <literal>MDY</literal> mode;
rejected in other modes</entry>
</row>
<row>
<entry>01/02/03</entry>
<entry>January 2, 2003 in <literal>MDY</literal> mode;
February 1, 2003 in <literal>DMY</literal> mode;
February 3, 2001 in <literal>YMD</literal>