Search Postgresql Archives

Re: Business days

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- -- 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux