Re: Question on how to use to_timestamp()

From: Deven Phillips <deven(dot)phillips(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org, Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
Subject: Re: Question on how to use to_timestamp()
Date: 2016-02-14 04:31:54
Message-ID: CAJw+4ND-sCqMgZ7SCVu3q-PRASyBSZFTGtxMAVK=2oXG8iDM6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks all!
On Feb 13, 2016 11:06 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> writes:
> > On 2/13/16, Deven Phillips <deven(dot)phillips(at)gmail(dot)com> 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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2016-02-14 09:56:36 Re: Optimize Query
Previous Message Tom Lane 2016-02-14 04:06:51 Re: Question on how to use to_timestamp()