Re: Recurring events - Mailing list pgsql-general

From Tom Lane
Subject Re: Recurring events
Date
Msg-id 11196.1012064654@sss.pgh.pa.us
Whole thread Raw
In response to Recurring events  (Francesco Casadei <f_casadei@libero.it>)
Responses Re: Recurring events  (Francesco Casadei <f_casadei@libero.it>)
List pgsql-general
Francesco Casadei <f_casadei@libero.it> writes:
> I want to publish these events on web and be able to show 'today events'. An
> event happens today if:

> start_date + n * recurrence = now()

If you only want accuracy to the nearest day, I'd think you should be
using type "date" not type "timestamp".  Date subtraction gives
integers:

test71=# select current_date - '2002-01-20'::date;
 ?column?
----------
        6
(1 row)

so making "recurrence" an integer too solves the problem.

            regards, tom lane

pgsql-general by date:

Previous
From: Francesco Casadei
Date:
Subject: Recurring events
Next
From: Frank Joerdens
Date:
Subject: Re: Problems with initdb on Cygwin