<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Formatting functions</title>
    <link>/en/sql-reference/functions/formatting-functions/</link>
    <description>Recent content in Formatting functions on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/functions/formatting-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: Template patterns for date/time formatting</title>
      <link>/en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/</guid>
      <description>
        
        
        &lt;p&gt;In an output template string (for &lt;code&gt;TO_CHAR&lt;/code&gt;), certain patterns are recognized and replaced with appropriately formatted data from the value to format. Any text that is not a template pattern is copied verbatim. Similarly, in an input template string (for anything other than &lt;code&gt;TO_CHAR&lt;/code&gt;), template patterns identify the parts of the input data string to look at and the values to find there.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;OpenText™ Analytics Database uses the ISO 8601:2004 style for date/time fields in the database log files. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2020-03-25 05:04:22.372 Init Session:0x7f8fcefec700-a000000013dcd4 [Txn] &amp;lt;INFO&amp;gt; Begin Txn: a000000013dcd4 &amp;#39;read role info&amp;#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Pattern&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;HH&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Hour of day (00-23)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;HH12&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Hour of day (01-12)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;HH24&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Hour of day (00-23)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MI&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Minute (00-59)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;SS&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Second (00-59)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MS&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Millisecond (000-999)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;US&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Microsecond (000000-999999)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;SSSS&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Seconds past midnight (0-86399)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;AM A.M. PM P.M.&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Meridian indicator (uppercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;am a.m. pm p.m.&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Meridian indicator (lowercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;Y YYY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Year (4 and more digits) with comma&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;YYYY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Year (4 and more digits)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;YYY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last 3 digits of year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;YY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last 2 digits of year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Y&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last digit of year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;IYYY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


ISO year (4 and more digits)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;IYY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last 3 digits of ISO year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;IY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last 2 digits of ISO year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;I&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Last digits of ISO year&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;BC B.C. AD A.D.&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Era indicator (uppercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;bc b.c. ad a.d.&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Era indicator (lowercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MONTH&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Full uppercase month name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Month&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Full mixed-case month name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;month&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Full lowercase month name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MON&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated uppercase month name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Mon&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated mixed-case month name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;mon&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated lowercase month name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MM&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Month number (01-12)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DAY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Full uppercase day name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Day&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Full mixed-case day name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;day&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


full lowercase day name (blank-padded to 9 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated uppercase day name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Dy&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated mixed-case day name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;dy&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Abbreviated lowercase day name (3 chars)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DDD&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Day of year (001-366)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DD&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;









&lt;p&gt;Day of month (01-31) for TIMESTAMP&lt;/p&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;
&lt;p&gt;For INTERVAL, DD is day of year (001-366) because day of month is undefined.&lt;/p&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;a name=&#34;D_TemplatePattern&#34;&gt;&lt;/a&gt;D&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Day of week (1-7; Sunday is 1)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;W&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Week of month (1-5) (The first week starts on the first day of the month.)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;WW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Week number of year (1-53) (The first week starts on the first day of the year.)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;IW&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


ISO week number of year (The first Thursday of the new year is in week 1.)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;CC&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Century (2 digits)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;J&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Julian Day (days since January 1, 4712 BC)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;Q&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Quarter&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;RM&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Month in Roman numerals (I-XII; I=January) (uppercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;rm&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Month in Roman numerals (i-xii; i=January) (lowercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;TZ&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Time-zone name (uppercase)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;tz&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Time-zone name (lowercase)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;The TO_DATE, TO_TIMESTAMP, and TO_TIMESTAMP_TZ functions do not validate the range of date or hour components during conversion. While these functions accept and convert input values, supplying out-of-range values (for example, time &#39;25:10&#39; has out-of-range hour) may result in shifted or unexpected date or timestamp outputs rather than raising an error.&lt;/p&gt;
&lt;p&gt;Example: The &#39;DD&#39; in the input is invalid. The &#39;TO_DATE&#39; returns an error.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;TwoOCT25&amp;#39;, &amp;#39;DDMonYY&amp;#39;);
   ERROR 3677:  Invalid input for dd: &amp;#34;twoOct25&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Example: If the &#39;DD&#39; value is out of range, such as 32, the function does not raise an error. Instead, it shifts the date forward by one day, converting &#39;32OCT24&#39; into November 1, 2024.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE (&amp;#39;32OCT24&amp;#39;, &amp;#39;DDMONYY&amp;#39;);
  to_date
------------
 2024-11-01
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Example: If the &#39;HH&#39; value is out of range, such as 25, the function does not raise an error. Instead, it interprets the value as 24 hours plus 1 hour, resulting in a date shift. Thus, converting &#39;29OCT2425:32:25&#39; into &#39;2024-10-30 01:32:25&#39;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_TIMESTAMP (&amp;#39;29OCT2425:32:25&amp;#39;,&amp;#39;DDMONYYHH:MI:SS&amp;#39;);
    TO_TIMESTAMP
---------------------
 2024-10-30 01:32:25
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;template-pattern-modifiers&#34;&gt;Template pattern modifiers&lt;/h2&gt;
&lt;p&gt;Certain modifiers can be applied to any date/time template pattern to alter its behavior. For example, &lt;code&gt;FMMonth&lt;/code&gt; is the &lt;code&gt;Month&lt;/code&gt; pattern with the &lt;code&gt;FM&lt;/code&gt; modifier.&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Modifier&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;AM&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Time is before 12:00&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;AT&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Ignored&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;JULIAN&lt;/code&gt;, &lt;code&gt;JD&lt;/code&gt;, &lt;code&gt;J&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Next field is Julian Day&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


&lt;code&gt;
&lt;code&gt;&lt;a name=&#34;FM_prefix&#34;&gt;&lt;/a&gt;FM prefix&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;






&lt;p&gt;Fill mode (suppress padding blanks and zeros)&lt;/p&gt;
&lt;p&gt;For example: &lt;code&gt;FMMonth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The FM modifier suppresses leading zeros and trailing blanks that would otherwise be added to make the output of a pattern fixed width.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;FX prefix&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Fixed format global option&lt;/p&gt;
&lt;p&gt;For example&lt;code&gt;: FX Month DD Day&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;ON&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Ignored&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;PM&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Time is on or after 12:00&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;&lt;code&gt;T&lt;/code&gt;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Next field is time&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;TH suffix&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Uppercase ordinal number suffix&lt;/p&gt;
&lt;p&gt;For example: &lt;code&gt;DDTH&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;th suffix&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Lowercase ordinal number suffix&lt;/p&gt;
&lt;p&gt;For example: &lt;code&gt;DDth&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;TM prefix&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Translation mode (print localized day and month names based on lc_messages). For example: &lt;code&gt;TMMonth&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Use TO_TIMESTAMP to convert an expression using the pattern &lt;code&gt;&#39;YYY MON&#39;&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_TIMESTAMP(&amp;#39;2017 JUN&amp;#39;, &amp;#39;YYYY MON&amp;#39;);
    TO_TIMESTAMP
---------------------
 2017-06-01 00:00:00
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use TO_DATE to convert an expression using the pattern &lt;code&gt;&#39;YYY-MMDD&#39;&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;2017-1231&amp;#39;, &amp;#39;YYYY-MMDD&amp;#39;);
  TO_DATE
------------
 2017-12-31
(1 row)
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Template patterns for numeric formatting</title>
      <link>/en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/</guid>
      <description>
        
        
        
&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
&lt;strong&gt;Pattern&lt;/strong&gt;&lt;/th&gt; 

&lt;th &gt;
&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;9&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Value with the specified number of digits&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;0&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Value with leading zeros&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;.&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Decimal point&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;,&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Group (thousand) separator&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PR&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Negative value in angle brackets&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;S&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Sign anchored to number (uses locale)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;L&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Currency symbol (uses locale)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;D&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Decimal point (uses locale)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;G&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Group separator (uses locale)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;MI&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Minus sign in specified position (if number &amp;lt; 0)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;PL&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Plus sign in specified position (if number &amp;gt; 0)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;SG&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Plus/minus sign in specified position&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;RN&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Roman numeral (input between 1 and 3999)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;TH/th&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Ordinal number suffix&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;V&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Shift specified number of digits&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;EEEE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
Scientific notation (not implemented yet)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A sign formatted using SG, PL, or MI is not anchored to the number. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT to_char(-12, &amp;#39;S9999&amp;#39;), to_char(-12, &amp;#39;MI9999&amp;#39;);
 to_char | to_char
---------+---------
   -12   | -  12
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR(-12, &#39;S9999&#39;) produces &#39; -12&#39;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR(-12, &#39;MI9999&#39;) produces &#39;- 12&#39;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;9 results in a value with the same number of digits as there are 9s. If a digit is not available it outputs a space.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TH does not convert values less than zero and does not convert fractional numbers.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;V effectively multiplies the input values by 10^&lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt;, where &lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt; is the number of digits following V. TO_CHAR does not support the use of V combined with a decimal point—for example: &lt;code&gt;99.9V99&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_BITSTRING</title>
      <link>/en/sql-reference/functions/formatting-functions/to-bitstring/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-bitstring/</guid>
      <description>
        
        
        &lt;p&gt;
Returns a VARCHAR that represents the given VARBINARY value in bitstring format. This function is the inverse of 
&lt;code&gt;&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/string-functions/bitstring-to-binary/#&#34;&gt;BITSTRING_TO_BINARY&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_BITSTRING ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The VARCHAR string to process.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_BITSTRING(&amp;#39;ab&amp;#39;::BINARY(2));
   to_bitstring
------------------
 0110000101100010
(1 row)

=&amp;gt; SELECT TO_BITSTRING(HEX_TO_BINARY(&amp;#39;0x10&amp;#39;));
 to_bitstring
--------------
00010000
(1 row)

=&amp;gt; SELECT TO_BITSTRING(HEX_TO_BINARY(&amp;#39;0xF0&amp;#39;));
 to_bitstring
--------------
11110000
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/string-functions/bitcount/#&#34;&gt;BITCOUNT&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_CHAR</title>
      <link>/en/sql-reference/functions/formatting-functions/to-char/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-char/</guid>
      <description>
        
        
        &lt;p&gt;Converts date/time and numeric values into text strings.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;Stable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_CHAR ( &lt;span class=&#34;code-variable&#34;&gt;expression &lt;/span&gt;[, &lt;span class=&#34;code-variable&#34;&gt;pattern &lt;/span&gt;]&lt;span class=&#34;code-variable&#34;&gt; &lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies the value to convert, one of the following data types:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/double-precision-float/&#34;&gt;DOUBLE PRECISION&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/integer/&#34;&gt;INTEGER&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/interval/&#34;&gt;INTERVAL&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/timetimetz/&#34;&gt;TIME/TIMETZ&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/data-types/datetime-data-types/timestamp-time-zone/&#34;&gt;TIMESTAMP/TIMESTAMPTZ&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following restrictions apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR does not support binary data types BINARY and VARBINARY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR does not support the use of V combined with a decimal point—for example, &lt;code&gt;99.9V99&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A CHAR or VARCHAR that specifies an output pattern string. See &lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#&#34;&gt;Template patterns for date/time formatting&lt;/a&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;OpenText™ Analytics Database pads TO_CHAR output with a leading space, so positive and negative values have the same length. To suppress padding, use the &lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#FM_prefix&#34;&gt;FM prefix&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR accepts TIME and TIMETZ data types as inputs if you explicitly cast TIME to TIMESTAMP and TIMETZ to TIMESTAMPTZ.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_CHAR(TIME &amp;#39;14:34:06.4&amp;#39;,&amp;#39;HH12:MI am&amp;#39;), TO_CHAR(TIMETZ &amp;#39;14:34:06.4+6&amp;#39;,&amp;#39;HH12:MI am&amp;#39;);
 TO_CHAR  | TO_CHAR
----------+----------
 02:34 pm | 04:34 am
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can extract the timezone hour from TIMETZ:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXTRACT(timezone_hour FROM TIMETZ &amp;#39;10:30+13:30&amp;#39;);
 date_part
-----------
        13
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ordinary text is allowed in TO_CHAR templates and is output literally. You can put a substring in double quotes to force it to be interpreted as literal text even if it contains pattern key words. In the following example, &lt;code&gt;YYYY&lt;/code&gt; is replaced by the year data, but the Y in &lt;code&gt;Year&lt;/code&gt; is not:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT to_char(CURRENT_TIMESTAMP, &amp;#39;&amp;#34;Hello Year &amp;#34; YYYY&amp;#39;);
     to_char
------------------
 Hello Year  2021
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TO_CHAR uses different day-of-the-week numbering (see the &lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#D_TemplatePattern&#34;&gt;D&lt;/a&gt; template pattern) than &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/extract/#&#34;&gt;EXTRACT&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Given an INTERVAL type, TO_CHAR formats &lt;code&gt;HH&lt;/code&gt; and &lt;code&gt;HH12&lt;/code&gt; as hours in a single day, while &lt;code&gt;HH24&lt;/code&gt; can output hours exceeding a single day—for example, &lt;code&gt;&amp;gt;24&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To include a double quote (&lt;code&gt;&amp;quot;&lt;/code&gt;) character in output, precede it with a double backslash (&lt;code&gt;\\&lt;/code&gt;). This is necessary because the backslash already has a special meaning in a string constant. For example:  &lt;code&gt;&#39;\\&amp;quot;YYYY Month\\&amp;quot;&#39;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When rounding, the last digit of the rounded representation is selected to be even if the number is exactly half way between the two.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
TO_CHAR expression and pattern argument&lt;/th&gt; 

&lt;th &gt;
Output&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;CURRENT_TIMESTAMP, &#39;Day, DD  HH12:MI:SS&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;Tuesday , 06  05:39:18&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;CURRENT_TIMESTAMP, &#39;FMDay, FMDD  HH12:MI:SS&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;Tuesday, 6  05:39:18&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;TIMETZ &#39;14:34:06.4+6&#39;,&#39;HH12:MI am&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;04:34 am&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-0.1, &#39;99.99&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;-.10&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-0.1, &#39;FM9.99&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;-.1&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;0.1, &#39;0.9&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;0.1&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;12, &#39;9990999.9&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;pre&gt;&lt;code&gt;`0012.0`&lt;/code&gt;&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;12, &#39;FM9990999.9&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;0012.&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;-485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;9 9 9&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;4 8 5&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;1485, &#39;9,999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;1,485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;1485, &#39;9G999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;1 485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;148.5, &#39;999.999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;148.500&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;148.5, &#39;FM999.999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;148.5&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;148.5, &#39;FM999.990&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;148.500&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;148.5, &#39;999D999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;148,500&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;3148.5, &#39;9G999D999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;3 148,500&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;999S&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;485-&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;999MI&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;485-&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;999MI&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;FM999MI&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;PL999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;+485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;SG999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;+485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;SG999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;-485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;9SG99&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;4-85&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-485, &#39;999PR&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;&amp;lt;485&amp;gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;L999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;DM 485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;RN&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;pre&gt;&lt;code&gt;    `CDLXXXV`&lt;/code&gt;&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;FMRN&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;CDLXXXV&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;5.2, &#39;FMRN&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;V&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;482, &#39;999th&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;482nd&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485, &#39;&amp;quot;Good number:&amp;quot;999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;Good number: 485&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;485.8, &#39;&amp;quot;Pre:&amp;quot;999&amp;quot; Post:&amp;quot; .999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;Pre: 485 Post: .800&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;12, &#39;99V999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;12000&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;12.4, &#39;99V999&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;12400&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;12.45, &#39;99V9&#39;&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;125&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;-1234.567&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;-1234.567&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;&#39;1999-12-25&#39;::DATE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;1999-12-25&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;&#39;1999-12-25 11:31&#39;::TIMESTAMP&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;1999-12-25 11:31:00&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;&#39;1999-12-25 11:31 EST&#39;::TIMESTAMPTZ&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;1999-12-25 11:31:00-05&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;&#39;3 days 1000.333 secs&#39;::INTERVAL&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;code&gt;3 days 00:16:40.333&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/date-part/#&#34;&gt;DATE_PART&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_DATE</title>
      <link>/en/sql-reference/functions/formatting-functions/to-date/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-date/</guid>
      <description>
        
        
        &lt;p&gt;
Converts a string value to a DATE type.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;Stable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_DATE ( &lt;span class=&#34;code-variable&#34;&gt;expression &lt;/span&gt;, &lt;span class=&#34;code-variable&#34;&gt;pattern &lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies the string value to convert, either &lt;code&gt;CHAR&lt;/code&gt; or &lt;code&gt;VARCHAR&lt;/code&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A &lt;code&gt;CHAR&lt;/code&gt; or &lt;code&gt;VARCHAR&lt;/code&gt; that specifies an output pattern string. See:
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#&#34;&gt;Template patterns for date/time formatting&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/#&#34;&gt;Template patterns for numeric formatting&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;input-value-considerations&#34;&gt;Input value considerations&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;TO_DATE&lt;/code&gt; requires a &lt;code&gt;CHAR&lt;/code&gt; or &lt;code&gt;VARCHAR&lt;/code&gt; expression. For other input types, use 
&lt;code&gt;&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/to-char/#&#34;&gt;TO_CHAR&lt;/a&gt;&lt;/code&gt; to perform an explicit cast to a &lt;code&gt;CHAR&lt;/code&gt; or &lt;code&gt;VARCHAR&lt;/code&gt; before using this function.&lt;/p&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;To use a double quote character in the output, precede it with a double backslash. This is necessary because the backslash already has a special meaning in a string constant. For example: &lt;code&gt;&#39;\\&amp;quot;YYYY Month\\&amp;quot;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP&lt;/code&gt;, &lt;code&gt;TO_TIMESTAMP_TZ&lt;/code&gt;, and &lt;code&gt;TO_DATE&lt;/code&gt; skip multiple blank spaces in the input string if the FX option is not used. FX must be specified as the first item in the template. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;YYYY MON&#39;)&lt;/code&gt; is correct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;FXYYYY MON&#39;)&lt;/code&gt; returns an error, because &lt;code&gt;TO_TIMESTAMP&lt;/code&gt; expects one space only.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;YYYY&lt;/code&gt; conversion from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt; has a restriction if you use a year with more than four digits. You must use a non-digit character or template after &lt;code&gt;YYYY&lt;/code&gt;, otherwise the year is always interpreted as four digits. For example, given the following arguments, &lt;code&gt;TO_DATE&lt;/code&gt; interprets the five-digit year 20000 as a four-digit year:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;200001131&amp;#39;,&amp;#39;YYYYMMDD&amp;#39;);
  TO_DATE
------------
 2000-01-13
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead, use a non-digit separator after the year. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;20000-1131&amp;#39;, &amp;#39;YYYY-MMDD&amp;#39;);
   TO_DATE
-------------
 20000-12-01
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In conversions from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt;, the CC field is ignored if there is a YYY, YYYY or Y,YYY field. If CC is used with YY or Y, then the year is computed as (CC–1)*100+YY.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;13 Feb 2000&amp;#39;, &amp;#39;DD Mon YYYY&amp;#39;);
  to_date
------------
 2000-02-13
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/#&#34;&gt;Date/time functions&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_HEX</title>
      <link>/en/sql-reference/functions/formatting-functions/to-hex/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-hex/</guid>
      <description>
        
        
        &lt;p&gt;
Returns a VARCHAR or VARBINARY representing the hexadecimal equivalent of a number. This function is the inverse of &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/string-functions/hex-to-binary/&#34;&gt;HEX_TO_BINARY&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_HEX ( &lt;span class=&#34;code-variable&#34;&gt;number&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;number&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;An &lt;a href=&#34;../../../../en/sql-reference/data-types/numeric-data-types/integer/&#34;&gt;INTEGER&lt;/a&gt; or &lt;a href=&#34;../../../../en/sql-reference/data-types/binary-data-types-binary-and-varbinary/&#34;&gt;VARBINARY&lt;/a&gt; value to convert to hexadecimal. If you supply a VARBINARY argument, the function&#39;s return value is not preceded by &lt;code&gt;0x&lt;/code&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_HEX(123456789);
 TO_HEX
---------
 75bcd15
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For VARBINARY inputs, the returned value is not preceded by &lt;code&gt;0x&lt;/code&gt;. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_HEX(&amp;#39;ab&amp;#39;::binary(2));
 TO_HEX
--------
 6162
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_NUMBER</title>
      <link>/en/sql-reference/functions/formatting-functions/to-number/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-number/</guid>
      <description>
        
        
        &lt;p&gt;Converts a string value to DOUBLE PRECISION.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;Stable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_NUMBER ( &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;, [ &lt;span class=&#34;code-variable&#34;&gt;pattern &lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies the string value to convert, either CHAR or VARCHAR.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A string value, either CHAR or VARCHAR, that specifies an output pattern string using one of the supported &lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/#&#34;&gt;Template patterns for numeric formatting&lt;/a&gt;. If you omit this parameter, &lt;code&gt;TO_NUMBER&lt;/code&gt; returns a floating point.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;p&gt;To use a double quote character in the output, precede it with a double backslash. This is necessary because the backslash already has a special meaning in a string constant. For example: &lt;code&gt;&#39;\\&amp;quot;YYYY Month\\&amp;quot;&#39;&lt;/code&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

To convert a date string to a numeric value, use the appropriate &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/&#34;&gt;date/time function&lt;/a&gt;, such as &lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/extract/&#34;&gt;EXTRACT&lt;/a&gt;.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_NUMBER(&amp;#39;MCML&amp;#39;, &amp;#39;rn&amp;#39;);
TO_NUMBER
-----------
1950
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It the &lt;code&gt;pattern&lt;/code&gt; parameter is omitted, the function returns a floating point. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_NUMBER(&amp;#39;-123.456e-01&amp;#39;);
 TO_NUMBER
-----------
  -12.3456
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_TIMESTAMP</title>
      <link>/en/sql-reference/functions/formatting-functions/to-timestamp/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-timestamp/</guid>
      <description>
        
        
        &lt;p&gt;Converts a string value or a UNIX/POSIX epoch value to a &lt;code&gt;TIMESTAMP&lt;/code&gt; type.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;Stable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_TIMESTAMP ( { &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;, &lt;span class=&#34;code-variable&#34;&gt;pattern&lt;/span&gt; } | &lt;span class=&#34;code-variable&#34;&gt;unix-epoch&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies the string value to convert, of type CHAR or VARCHAR.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A CHAR or VARCHAR that specifies an output pattern string. See:
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#&#34;&gt;Template patterns for date/time formatting&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/#&#34;&gt;Template patterns for numeric formatting&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;unix-epoch&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;DOUBLE PRECISION value that specifies some number of seconds elapsed since midnight UTC of January 1, 1970, excluding leap seconds. INTEGER values are implicitly cast to DOUBLE PRECISION.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Millisecond (MS) and microsecond (US) values in a conversion from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; are used as part of the seconds after the decimal point. For example &lt;code&gt;TO_TIMESTAMP(&#39;12:3&#39;, &#39;SS:MS&#39;)&lt;/code&gt; is not 3 milliseconds, but 300, because the conversion counts it as 12 + 0.3 seconds. This means for the format &lt;code&gt;SS:MS&lt;/code&gt;, the input values &lt;code&gt;12:3&lt;/code&gt;, &lt;code&gt;12:30&lt;/code&gt;, and &lt;code&gt;12:300&lt;/code&gt; specify the same number of milliseconds. To get three milliseconds, use &lt;code&gt;12:003&lt;/code&gt;, which the conversion counts as &lt;code&gt;12 + 0.003 = 12.003&lt;/code&gt; seconds.&lt;/p&gt;
&lt;p&gt;Here is a more complex example: &lt;code&gt;TO_TIMESTAMP(&#39;15:12:02.020.001230&#39;, &#39;HH:MI:SS.MS.US&#39;)&lt;/code&gt; is 15 hours, 12 minutes, and 2 seconds + 20 milliseconds + 1230 microseconds = 2.021230 seconds.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a double quote character in the output, precede it with a double backslash. This is necessary because the backslash already has a special meaning in a string constant. For example: &lt;code&gt;&#39;\\&amp;quot;YYYY Month\\&amp;quot;&#39;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP&lt;/code&gt;, &lt;code&gt;TO_TIMESTAMP_TZ&lt;/code&gt;, and &lt;code&gt;TO_DATE&lt;/code&gt; skip multiple blank spaces in the input string if the FX option is not used. FX must be specified as the first item in the template. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;YYYY MON&#39;)&lt;/code&gt; is correct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;FXYYYY MON&#39;)&lt;/code&gt; returns an error, because &lt;code&gt;TO_TIMESTAMP&lt;/code&gt; expects one space only.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;YYYY&lt;/code&gt; conversion from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt; has a restriction if you use a year with more than four digits. You must use a non-digit character or template after &lt;code&gt;YYYY&lt;/code&gt;, otherwise the year is always interpreted as four digits. For example, given the following arguments, &lt;code&gt;TO_DATE&lt;/code&gt; interprets the five-digit year 20000 as a four-digit year:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;200001131&amp;#39;,&amp;#39;YYYYMMDD&amp;#39;);
  TO_DATE
------------
 2000-01-13
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead, use a non-digit separator after the year. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;20000-1131&amp;#39;, &amp;#39;YYYY-MMDD&amp;#39;);
   TO_DATE
-------------
 20000-12-01
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In conversions from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt;, the CC field is ignored if there is a YYY, YYYY or Y,YYY field. If CC is used with YY or Y, then the year is computed as (CC–1)*100+YY.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_TIMESTAMP(&amp;#39;13 Feb 2009&amp;#39;, &amp;#39;DD Mon YYYY&amp;#39;);
    TO_TIMESTAMP
---------------------
 1200-02-13 00:00:00
(1 row)
=&amp;gt; SELECT TO_TIMESTAMP(200120400);
    TO_TIMESTAMP
---------------------
 1976-05-05 01:00:00
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/#&#34;&gt;Date/time functions&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: TO_TIMESTAMP_TZ</title>
      <link>/en/sql-reference/functions/formatting-functions/to-timestamp-tz/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/formatting-functions/to-timestamp-tz/</guid>
      <description>
        
        
        &lt;p&gt;Converts a string value or a UNIX/POSIX epoch value to a &lt;code&gt;TIMESTAMP WITH TIME ZONE&lt;/code&gt; type.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;p&gt;&lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt; if single argument form, &lt;a class=&#34;glosslink&#34; href=&#34;../../../../en/glossary/stable-functions/&#34; title=&#34;See also Immutable (invariant) functions.&#34;&gt;Stable&lt;/a&gt; otherwise.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TO_TIMESTAMP_TZ ( { &lt;span class=&#34;code-variable&#34;&gt;expression&lt;/span&gt;, &lt;span class=&#34;code-variable&#34;&gt;pattern&lt;/span&gt; } | &lt;span class=&#34;code-variable&#34;&gt;unix-epoch&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies the string value to convert, of type CHAR or VARCHAR.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A CHAR or VARCHAR that specifies an output pattern string. See:
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-datetime-formatting/#&#34;&gt;Template patterns for date/time formatting&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/formatting-functions/template-patterns-numeric-formatting/#&#34;&gt;Template patterns for numeric formatting&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;unix-epoch&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A DOUBLE PRECISION value that specifies some number of seconds elapsed since midnight UTC of January 1, 1970, excluding leap seconds. INTEGER values are implicitly cast to DOUBLE PRECISION.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Millisecond (MS) and microsecond (US) values in a conversion from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; are used as part of the seconds after the decimal point. For example &lt;code&gt;TO_TIMESTAMP(&#39;12:3&#39;, &#39;SS:MS&#39;)&lt;/code&gt; is not 3 milliseconds, but 300, because the conversion counts it as 12 + 0.3 seconds. This means for the format &lt;code&gt;SS:MS&lt;/code&gt;, the input values &lt;code&gt;12:3&lt;/code&gt;, &lt;code&gt;12:30&lt;/code&gt;, and &lt;code&gt;12:300&lt;/code&gt; specify the same number of milliseconds. To get three milliseconds, use &lt;code&gt;12:003&lt;/code&gt;, which the conversion counts as &lt;code&gt;12 + 0.003 = 12.003&lt;/code&gt; seconds.&lt;/p&gt;
&lt;p&gt;Here is a more complex example: &lt;code&gt;TO_TIMESTAMP(&#39;15:12:02.020.001230&#39;, &#39;HH:MI:SS.MS.US&#39;)&lt;/code&gt; is 15 hours, 12 minutes, and 2 seconds + 20 milliseconds + 1230 microseconds = 2.021230 seconds.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a double quote character in the output, precede it with a double backslash. This is necessary because the backslash already has a special meaning in a string constant. For example: &lt;code&gt;&#39;\\&amp;quot;YYYY Month\\&amp;quot;&#39;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP&lt;/code&gt;, &lt;code&gt;TO_TIMESTAMP_TZ&lt;/code&gt;, and &lt;code&gt;TO_DATE&lt;/code&gt; skip multiple blank spaces in the input string if the FX option is not used. FX must be specified as the first item in the template. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;YYYY MON&#39;)&lt;/code&gt; is correct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TO_TIMESTAMP(&#39;2000 JUN&#39;, &#39;FXYYYY MON&#39;)&lt;/code&gt; returns an error, because &lt;code&gt;TO_TIMESTAMP&lt;/code&gt; expects one space only.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;YYYY&lt;/code&gt; conversion from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt; has a restriction if you use a year with more than four digits. You must use a non-digit character or template after &lt;code&gt;YYYY&lt;/code&gt;, otherwise the year is always interpreted as four digits. For example, given the following arguments, &lt;code&gt;TO_DATE&lt;/code&gt; interprets the five-digit year 20000 as a four-digit year:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;200001131&amp;#39;,&amp;#39;YYYYMMDD&amp;#39;);
  TO_DATE
------------
 2000-01-13
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead, use a non-digit separator after the year. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_DATE(&amp;#39;20000-1131&amp;#39;, &amp;#39;YYYY-MMDD&amp;#39;);
   TO_DATE
-------------
 20000-12-01
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In conversions from string to &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;DATE&lt;/code&gt;, the CC field is ignored if there is a YYY, YYYY or Y,YYY field. If CC is used with YY or Y, then the year is computed as (CC–1)*100+YY.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT TO_TIMESTAMP_TZ(&amp;#39;13 Feb 2009&amp;#39;, &amp;#39;DD Mon YYY&amp;#39;);
    TO_TIMESTAMP_TZ
------------------------
 1200-02-13 00:00:00-05
(1 row)

=&amp;gt; SELECT TO_TIMESTAMP_TZ(200120400);
    TO_TIMESTAMP_TZ
------------------------
 1976-05-05 01:00:00-04
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/sql-reference/functions/data-type-specific-functions/datetime-functions/#&#34;&gt;Date/time functions&lt;/a&gt;

      </description>
    </item>
    
  </channel>
</rss>
