diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index c76d357..19197ce 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -5426,7 +5426,7 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); to_date(text, text) date - convert string to date + convert string to date (see usage notes) to_date('05 Dec 2000', 'DD Mon YYYY') @@ -5448,7 +5448,7 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); to_timestamp(text, text) timestamp with time zone - convert string to time stamp + convert string to time stamp (see usage notes) to_timestamp('05 Dec 2000', 'DD Mon YYYY') @@ -5750,10 +5750,32 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); Usage notes for date/time formatting: + + + The to_date and to_timestamp + functions exist to parse unusual input formats that cannot be handled + by casting. These functions interpret input liberally and with minimal + error checking so the conversion has the potential to yield unexpected + results. Read the following notes and test carefully before use. + Casting is the preferred method of conversion wherever possible. + + + + + + Input to to_date and + to_timestamp is not restricted to normal ranges + thus to_date('20096040','YYYYMMDD') returns + 2014-01-17 rather than generating an error. + + + + + FM suppresses leading zeroes and trailing blanks that would otherwise be added to make the output of a pattern be fixed-width. In PostgreSQL,