Re: Date conversion using day of week

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: marc(at)bloodnok(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Date conversion using day of week
Date: 2011-03-29 15:33:59
Message-ID: 4D91FBE7.9020906@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hans C. Poo 2011-03-29 15:36:57 Script perl para eliminar constraints duplicados
Previous Message Adrian Klaver 2011-03-29 15:31:26 Re: Date conversion using day of week

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2011-03-29 15:50:56 Re: Date conversion using day of week
Previous Message Adrian Klaver 2011-03-29 15:31:26 Re: Date conversion using day of week