Re: Date Questions

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Date Questions
Date: 2007-01-24 00:23:17
Message-ID: 45B6A6F5.2010109@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/23/07 17:22, Robert Sanford wrote:
> 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?

01-Jan was a Monday. So, is 07-Jan the first full week of the
month, or not?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFtqb1S9HxQb37XmcRAnn5AKCXcaxwVSdVg+OVoHNebjGkJgA9RACgmATo
qcoUVqmUrODTLPDOc0pFl64=
=Vz8N
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message elein 2007-01-24 00:38:33 Re: [1/2 OFF] Varlena.com inaccessible from .br (Blocked?)
Previous Message Tom Lane 2007-01-23 23:40:09 Re: Date Questions