Re: workday function

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: workday function
Date: 2007-05-15 14:09:40
Message-ID: 200705151509.41320.gary.stainburn@ringways.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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-01
2007-04-06
2007-04-09
2007-05-07
2007-05-28
2007-08-27
2007-12-25
2007-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

Attachment Content-Type Size
bank_holidays.sql text/plain 3.2 KB

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Hanson 2007-05-15 17:19:54 Adding "on delete cascade" to all foreign key constraints
Previous Message Andrew Sullivan 2007-05-15 13:36:22 Re: Serial number of a record