<type>text</type>, <type>text</type> )
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Converts string to time stamp according to the given format.
(See also <function>to_timestamp(double precision)</function> in
<xref linkend="functions-datetime-table"/>.)
</para>
<para>
<literal>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</literal>
<returnvalue>2000-12-05 00:00:00-05</returnvalue>
</para></entry>
</row>
</tbody>
</tgroup>
</table>
<tip>
<para>
<function>to_timestamp</function> and <function>to_date</function>
exist to handle input formats that cannot be converted by
simple casting. For most standard date/time formats, simply casting the
source string to the required data type works, and is much easier.
Similarly, <function>to_number</function> is unnecessary for standard numeric
representations.
</para>
</tip>
<para>
In a <function>to_char</function> output template string, there are certain
patterns that are recognized and replaced with appropriately-formatted
data based on the given value. Any text that is not a template pattern is
simply copied verbatim. Similarly, in an input template string (for the
other functions), template patterns identify the values to be supplied by
the input data string. If there are characters in the template string
that are not template patterns, the corresponding characters in the input
data string are simply skipped over (whether or not they are equal to the
template string characters).
</para>
<para>
<xref linkend="functions-formatting-datetime-table"/> shows the
template patterns available for formatting date and time values.
</para>
<table id="functions-formatting-datetime-table">
<title>Template Patterns for Date/Time Formatting</title>
<tgroup cols="2">
<thead>
<row>
<entry>Pattern</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>HH</literal></entry>
<entry>hour of day (01–12)</entry>
</row>
<row>
<entry><literal>HH12</literal></entry>
<entry>hour of day (01–12)</entry>
</row>
<row>
<entry><literal>HH24</literal></entry>
<entry>hour of day (00–23)</entry>
</row>
<row>
<entry><literal>MI</literal></entry>
<entry>minute (00–59)</entry>
</row>
<row>
<entry><literal>SS</literal></entry>
<entry>second (00–59)</entry>
</row>
<row>
<entry><literal>MS</literal></entry>
<entry>millisecond (000–999)</entry>
</row>
<row>
<entry><literal>US</literal></entry>
<entry>microsecond (000000–999999)</entry>
</row>
<row>
<entry><literal>FF1</literal></entry>
<entry>tenth of second (0–9)</entry>
</row>
<row>
<entry><literal>FF2</literal></entry>
<entry>hundredth of second (00–99)</entry>
</row>
<row>
<entry><literal>FF3</literal></entry>
<entry>millisecond (000–999)</entry>
</row>
<row>
<entry><literal>FF4</literal></entry>
<entry>tenth of a millisecond (0000–9999)</entry>
</row>
<row>
<entry><literal>FF5</literal></entry>
<entry>hundredth of a millisecond (00000–99999)</entry>
</row>
<row>
<entry><literal>FF6</literal></entry>
<entry>microsecond (000000–999999)</entry>
</row>
<row>
<entry><literal>SSSS</literal>, <literal>SSSSS</literal></entry>
<entry>seconds past midnight (0–86399)</entry>
</row>
<row>
<entry><literal>AM</literal>, <literal>am</literal>,
<literal>PM</literal> or