Re: Business days

From: "Peter Childs" <peterachilds(at)gmail(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Business days
Date: 2007-04-27 07:18:55
Message-ID: a2de01dd0704270018n270728f7n9f272060e8a04b9e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 26/04/07, Greg Sabino Mullane <greg(at)turnstep(dot)com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
> >> However, you quickly run into the problem of holidays. While you
> >> could construct a helper table listing all the holidays, ones that
> >> don't fall on the same day every year (e.g. Easter) will trip
> >> you up.
>
> > Er, isn't Easter usually on a Sunday?
>
> I meant the same numerical date, e.g. Christmas is always December 25th,
> and so is a little easier programatically than the rules for Easter. If
> you meant that Sunday is never a business day, then yes, it was a bad
> example. :)
>
> > Anyway, I also found this, the first hit if you google "sql holidays":
> > http://www.sqlmag.com/Article/ArticleID/25899/sql_server_25899.html
> >
> > The big ugly union might need to be munged a bit, but most of the non-
> > weekend US holidays seem to be there.
>
> Sure, that's an alternative, but it seems a bit too much reinventing an
> already existing wheel. I was amused to see the script had the ill-fated
> Lee-Jackson-King day in it. Ideally, we'd want a Postgres table that
> describes the rules for each holiday, and then a function that reads it
> on the fly. Perhaps a project for another day...
>

More complicated than that....

Easter read Good Friday and Easter Monday.

Christmas Eve (does it count or not)

Christmas Day, Boxing Day if it falls on a Weekend, Bank holidays are
applied in loo on the following monday and tuesday as necessary.

There are some quite good list available but you will have to work out
what your local logic actually is.

Peter.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Felix Kater 2007-04-27 07:22:47 binary representation of date and numeric
Previous Message Oleg Bartunov 2007-04-27 04:51:39 Re: PostgreSQL upgrade server A -> server Bx