February 3rd</literal></entry>
<entry><literal>1954-02-03</literal></entry>
</row>
<row>
<entry><literal>mmm.dd.yyyy</literal></entry>
<entry><literal>041269</literal></entry>
<entry><literal>1969-04-12</literal></entry>
</row>
<row>
<entry><literal>yy/mm/dd</literal></entry>
<entry><literal>In the year 2525, in the month of July, mankind will be alive on the 28th day</literal></entry>
<entry><literal>2525-07-28</literal></entry>
</row>
<row>
<entry><literal>dd-mm-yy</literal></entry>
<entry><literal>I said on the 28th of July in the year 2525</literal></entry>
<entry><literal>2525-07-28</literal></entry>
</row>
<row>
<entry><literal>mmm.dd.yyyy</literal></entry>
<entry><literal>9/14/58</literal></entry>
<entry><literal>1958-09-14</literal></entry>
</row>
<row>
<entry><literal>yy/mm/dd</literal></entry>
<entry><literal>47/03/29</literal></entry>
<entry><literal>1947-03-29</literal></entry>
</row>
<row>
<entry><literal>mmm.dd.yyyy</literal></entry>
<entry><literal>oct 28 1975</literal></entry>
<entry><literal>1975-10-28</literal></entry>
</row>
<row>
<entry><literal>mmddyy</literal></entry>
<entry><literal>Nov 14th, 1985</literal></entry>
<entry><literal>1985-11-14</literal></entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2 id="ecpg-pgtypes-timestamp">
<title>The timestamp Type</title>
<para>
The timestamp type in C enables your programs to deal with data of the SQL
type timestamp. See <xref linkend="datatype-datetime"/> for the equivalent
type in the <productname>PostgreSQL</productname> server.
</para>
<para>
The following functions can be used to work with the timestamp type:
<variablelist>
<varlistentry id="pgtypestimestampfromasc">
<term><function>PGTYPEStimestamp_from_asc</function></term>
<listitem>
<para>
Parse a timestamp from its textual representation into a timestamp
variable.
<synopsis>
timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr);
</synopsis>
The function receives the string to parse (<literal>str</literal>) and a
pointer to a C char* (<literal>endptr</literal>).
At the moment ECPG always parses
the complete string and so it currently does not support to store the
address of the first invalid character in <literal>*endptr</literal>.
You can safely set <literal>endptr</literal> to NULL.
</para>
<para>
The function returns the parsed timestamp on success. On error,
<literal>PGTYPESInvalidTimestamp</literal> is returned and <varname>errno</varname> is
set to <literal>PGTYPES_TS_BAD_TIMESTAMP</literal>. See <xref linkend="pgtypesinvalidtimestamp"/> for important notes on this value.
</para>
<para>
In general, the input string can contain any combination of an allowed
date specification, a whitespace character and an allowed time
specification. Note that time zones are not supported by ECPG. It can
parse them but does not apply any calculation as the
<productname>PostgreSQL</productname> server does for example. Timezone
specifiers are silently discarded.
</para>
<para>
<xref linkend="ecpg-pgtypestimestamp-from-asc-example-table"/> contains a few examples for input strings.
</para>
<table id="ecpg-pgtypestimestamp-from-asc-example-table">
<title>Valid Input Formats for <function>PGTYPEStimestamp_from_asc</function></title>