[SQL] workday function

2007-05-15 Thread Gary Stainburn
Hi folks I need to be able to add and subtract workdays, something like select CURRENT_DATE - '3 work days'::interval; I can't see how to do this natively so I'm looking to write a function to do it and was wondering if anyone's already done it. While Googling I've found that MS Excel has a

Re: [SQL] workday function

2007-05-15 Thread Richard Huxton
Gary Stainburn wrote: Hi folks I need to be able to add and subtract workdays, something like select CURRENT_DATE - '3 work days'::interval; I can't see how to do this natively so I'm looking to write a function to do it and was wondering if anyone's already done it. Don't know of one -

Re: [SQL] workday function

2007-05-15 Thread Richard Huxton
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.

Re: [SQL] workday function

2007-05-15 Thread Kenneth Gonsalves
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

Re: [SQL] workday function

2007-05-15 Thread Dave Page
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.

Re: [SQL] workday function

2007-05-15 Thread Reinoud van Leeuwen
On Tue, May 15, 2007 at 09:51:34AM +0100, Gary Stainburn wrote: Hi folks I need to be able to add and subtract workdays, something like select CURRENT_DATE - '3 work days'::interval; Would that take holidays into account? (and wich ones?) --

Re: [SQL] workday function

2007-05-15 Thread Pavel Stehule
Hello You can use functions from Orafce package http://www.pgsql.cz/index.php/Oracle_functionality_%28en%29#PLVdate sample: SELECT plvdate.plvdate.default_holydays('czech'); SELECT plvdate.add_bizdays(CURRENT_DATE, 10); SELECT plvdate.isbizday('2006-12-25'); Regards Pavel Stehule

Re: [SQL] workday function

2007-05-15 Thread Gary Stainburn
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