Date Questions

From: "Robert Sanford" <rsanford(at)trefs(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Date Questions
Date: 2007-01-23 23:22:35
Message-ID: B7FA3B7327F5D043AB403A1E0709628CECDC18@exchg3.corp.orrtax.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It appears to me that there is some inconsistency in the date
calculations for my PostgreSQL install (version 8.0 on Win32).

January 07 of 2007 is a Sunday. Based on the documentation I would
expect that date to be the first day of the second week of the year
2007. That's not what I'm getting. When I run:

select date_part('DOW'::text, '2007-01-07'::timestamp);

I receive my expected result of 0 indicating that Sunday is the first
day of the week. But, when I run

select date_part('week'::text, '2007-01-07'::timestamp);

I get a result of 1 indicating that it is part of the first week of the
year. That seems inconsistent with the first result which would indicate
it was the first day of the second week of the year. I was expecting a
result of 2.

Am I missing something?

Many thanks!

rjsjr

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-23 23:40:09 Re: Date Questions
Previous Message Harald Fuchs 2007-01-23 23:21:44 Re: psql substitution variables