Re: workday function - Mailing list pgsql-sql

From Gary Stainburn
Subject Re: workday function
Date
Msg-id 200705151509.41320.gary.stainburn@ringways.co.uk
Whole thread Raw
In response to Re: workday function  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
On Tuesday 15 May 2007 10:17, Richard Huxton wrote:
> Kenneth Gonsalves wrote:
> > On 15-May-07, at 2:39 PM, Richard Huxton wrote:
> >> Don't know of one - not sure what "workday" would mean in a global
> >> sense. I mean, Mon-Fri in most European office settings, but you'd
> >> include Sat in retail settings and in Islamic countries presumably
> >> exclude Fridays. Our local library shuts early on Mondays iirc but is
> >> open Saturday mornings.
> >
> > and i hear in england people work half day on wednesday
>
> Some shops and banks used to when I was a child. Nowadays many
> supermarkets are open 24 hours (except Sundays - due to legislation)
>
> Of course, I've been in companies where some people working for half the
> day would be a huge improvement :-)

As a first stage I've written a number of functions to calculate the standard 
UK bank holidays, and return these as a dataset.

select * from bank_holidays(2007);bank_holidays
---------------2007-01-012007-04-062007-04-092007-05-072007-05-282007-08-272007-12-252007-12-26
(8 rows)

I've attached the code for anyone who want to use or improve it.

It should be fairly simple to write a function to use that dataset to ignore 
*non-working* days.

-- 
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000

pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Serial number of a record
Next
From: Peter Hanson
Date:
Subject: Adding "on delete cascade" to all foreign key constraints