Re: to_date() and to_timestamp() with negative years

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Bryn Llewellyn <bryn(at)yugabyte(dot)com>, Tom Lane PostgreSQL <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: to_date() and to_timestamp() with negative years
Date: 2021-11-04 00:07:36
Message-ID: 30ba14d1-31fc-31ac-aaff-ac42589d7a07@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/3/21 17:00, Adrian Klaver wrote:
> On 11/3/21 15:56, Bryn Llewellyn wrote:
>>> tgl(at)sss(dot)pgh(dot)pa(dot)us wrote:
>>>

>> And you have to have some kind of separator between the years
>> substring and the adjacent one(s) even to succeed with years that have
>> more than four digits. Another usage note stresses that while this is OK:
>>
>> select to_date('12340101', 'YYYYMMDD');
>>
>> this isn't:
>>
>> select to_date('123450101', 'YYYYMMDD');
>
> It does with a tweak:
>
> select to_date('12345 0101', 'FMYYYYMMDD');
>    to_date
> -------------
>  12345-01-01

Well that was just plain wrong. I was not paying attention.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2021-11-04 00:54:40 Re: Error with Insert from View with ON Conflict
Previous Message Adrian Klaver 2021-11-04 00:00:01 Re: to_date() and to_timestamp() with negative years