From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | Steve Crawford <scrawford(at)pinpointresearch(dot)com>, marc(at)bloodnok(dot)com |
Subject: | Re: Date conversion using day of week |
Date: | 2011-03-29 15:50:56 |
Message-ID: | 201103290850.56928.adrian.klaver@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Tuesday, March 29, 2011 8:33:59 am Steve Crawford wrote:
> On 03/29/2011 08:07 AM, Marc Munro wrote:
> > I'm trying to validate a day of the week, and thought that to_date would
> > do the job for me. But I found a case where it cannot tell the
> > difference between sunday and monday. Is this a bug or intended
> > behaviour?
> >
> > dev=# select to_date('2011-13-Mon', 'YYYY-IW-DY');
> >
> > to_date
> >
> > ------------
> >
> > 2011-03-28
>
> Based on running the queries in 9.0, it's behavior that has been corrected:
>
> select to_date('Mon1-13-Tue', 'YYYY-IW-DY');
> ERROR: invalid combination of date conventions
> HINT: Do not mix Gregorian and ISO week date conventions in a
> formatting template.
>
> Cheers,
> Steve
Yes and no:)
test(5432)aklaver=>select to_date('2011-13-MON', 'IYYY-IW-DY');
to_date
------------
2011-03-28
(1 row)
test(5432)aklaver=>select to_date('2011-13-SUN', 'IYYY-IW-DY');
to_date
------------
2011-03-28
(1 row)
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Crawford | 2011-03-29 16:02:52 | Re: Date conversion using day of week |
Previous Message | Guillaume Lelarge | 2011-03-29 15:48:53 | Re: foreign data wrappers |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2011-03-29 15:54:17 | Re: Problem with streaming replication, backups, and recovery (9.0.x) |
Previous Message | Steve Crawford | 2011-03-29 15:33:59 | Re: Date conversion using day of week |