Re: to_date() and invalid dates

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: to_date() and invalid dates
Date: 2014-01-20 15:37:36
Message-ID: 52DD42C0.701@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/20/2014 07:32 AM, Thomas Kellerer wrote:
> Michael Nolan, 20.01.2014 16:17:
>> Thomas, try this:
>>
>> '2013-02-31'::date
>
> Thanks, I know this "works", but this can't be used if you have a non-ISO date string
>
>

Hmm:

test=> SELECT '2013-02-31'::date;
ERROR: date/time field value out of range: "2013-02-31"
LINE 1: SELECT '2013-02-31'::date;
^
test=> SELECT '2/31/2013'::date;
ERROR: date/time field value out of range: "2/31/2013"
LINE 1: SELECT '2/31/2013'::date;
^
test=> SELECT '2/26/2013'::date;
date
------------
2013-02-26
(1 row)

>
>
>
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2014-01-20 15:41:10 Re: incrementing without violating a constraint
Previous Message Thomas Kellerer 2014-01-20 15:32:38 Re: to_date() and invalid dates