Re: Date Questions

From: "Robert Sanford" <rsanford(at)trefs(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Date Questions
Date: 2007-01-24 03:46:24
Message-ID: B7FA3B7327F5D043AB403A1E0709628CECDC26@exchg3.corp.orrtax.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Every app has its joyful inconsistencies and learning them is part of
the process...

So if I'm currently doing a GROUP BY date_part(week, datecolumn) in a
view and I really want to be using the DOW convention I need to write a
customized get_sunday_week_num (date) to make everything consistent. Or,
did someone else run into this problem and solve it before me?

rjsjr

PS - Coming from an MS-SQL Server background I *love* the date
functionality in PostgreSQL.

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, January 23, 2007 5:40 PM
> To: Robert Sanford
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Date Questions
>
> "Robert Sanford" <rsanford(at)trefs(dot)com> writes:
> > It appears to me that there is some inconsistency in the date
> > calculations for my PostgreSQL install (version 8.0 on Win32).
>
> extract(DOW) follows the convention that the week starts on
> Sunday, but extract(WEEK) uses the ISO convention, which
> includes weeks starting on Monday. No, it's not super
> consistent, but hardly anything about date/time conventions is :-(
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2007-01-24 04:02:21 Re: Date Questions
Previous Message Jim Nasby 2007-01-24 03:01:41 Re: [GENERAL] Autovacuum Improvements