Date conversion using day of week

From: Marc Munro <marc(at)bloodnok(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Date conversion using day of week
Date: 2011-03-29 15:07:48
Message-ID: 1301411268.23783.6.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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
(1 row)

dev=# select to_date('2011-13-Sun', 'YYYY-IW-DY');
to_date
------------
2011-03-28
(1 row)

dev=# select to_date('2011-13-Tue', 'YYYY-IW-DY');
to_date
------------
2011-03-29
(1 row)

This is on postgres 8.3.14.

__
Marc

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A.M. 2011-03-29 15:29:16 Re: not like perl..
Previous Message Michael Leinartas 2011-03-29 14:42:01 Is pglesslog stable for use in 9.0?

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2011-03-29 15:31:26 Re: Date conversion using day of week
Previous Message Dimitri Fontaine 2011-03-29 14:48:28 Re: Additional options for Sync Replication