From: | "John D(dot) Burger" <john(at)mitre(dot)org> |
---|---|
To: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Business days |
Date: | 2007-04-26 18:55:54 |
Message-ID: | 596BB93D-71F0-41CE-9A96-DB9855CF4999@mitre.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> - -- I need to get the a total number of business days (from monday to
> - -- friday) between two dates.
> - -- Someone can help me please.
>
> A simplistic approach that counts a "business day" as being Monday
> through Friday would be something like this:
> 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? 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.
- John D. Burger
MITRE
From | Date | Subject | |
---|---|---|---|
Next Message | Leonel | 2007-04-26 19:02:57 | Re: Feature request - have postgresql log warning when new sub-release comes out. |
Previous Message | Ron Mayer | 2007-04-26 18:38:44 | Re: Feature request - have postgresql log warning when new sub-release comes out. |