Search Postgresql Archives

Re: Question on how to use to_timestamp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vitaly Burovoy <vitaly.burovoy@xxxxxxxxx> writes:
> On 2/13/16, Deven Phillips <deven.phillips@xxxxxxxxx> wrote:
>> I'm trying to convert a series of ISO8601 strings into TIMESTAMPs for use
>> with a function: ...

> If your data is already in a correct ISO8601 format, you can use a
> direct cast to timestamptz type:

Yeah.  95% of the time, the answer to "how to use to_timestamp()" is
"don't".  The native input converter for the date/timestamp/timestamptz
data types is perfectly capable of parsing most common date formats,
with a lot less muss and fuss than to_timestamp.  At worst you might have
to give it a hint about DMY vs. MDY field ordering via the DateStyle
setting.  If your input is YMD order then you don't have to worry about
that at all.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux