Date conversion using day of week - Mailing list pgsql-general

From Marc Munro
Subject Date conversion using day of week
Date
Msg-id 1301411268.23783.6.camel@bloodnok.com
Whole thread Raw
Responses Re: Date conversion using day of week  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: Date conversion using day of week  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-general
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


Attachment

pgsql-general by date:

Previous
From: Michael Leinartas
Date:
Subject: Is pglesslog stable for use in 9.0?
Next
From: "A.M."
Date:
Subject: Re: not like perl..