Skip site navigation (1) Skip section navigation (2)

Weekends between

From: Luiz Eduardo Cantanhede Neri <lecneri(at)gmail(dot)com>
To: postgresql novice <pgsql-novice(at)postgresql(dot)org>
Subject: Weekends between
Date: 2009-07-30 14:40:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi guys,

I'm trying to find out how many weekends there's between 2 dates and
Googling I found this algorithm from

date := now - day_of_the_week
> interval := interval + day_of_the_week
> date := date + int( interval/5)x7 + ( interval mod 5)

Assuming that now is current datetime, what I should expect from a
date - int? or some1 could explain it better please?


pgsql-novice by date

Next:From: Serge FonvilleDate: 2009-07-30 14:50:12
Subject: Re: Weekends between
Previous:From: Andreas WenkDate: 2009-07-29 11:22:15
Subject: Re: trouble with connection

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group