Re: Business days - Mailing list pgsql-general

From John D. Burger
Subject Re: Business days
Date
Msg-id 596BB93D-71F0-41CE-9A96-DB9855CF4999@mitre.org
Whole thread Raw
In response to Re: Business days  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: Business days  ("Greg Sabino Mullane" <greg@turnstep.com>)
List 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



pgsql-general by date:

Previous
From: Ron Mayer
Date:
Subject: Re: Feature request - have postgresql log warning when new sub-release comes out.
Next
From: Leonel
Date:
Subject: Re: Feature request - have postgresql log warning when new sub-release comes out.