Need Help With Dates. - Mailing list pgsql-sql

From John
Subject Need Help With Dates.
Date
Msg-id Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com
Whole thread Raw
List pgsql-sql
Hello.
I just migrated a database from MySQL to postgreSQL and am having trouble
wit postgres' dates.

MySQL dealt with dates very well, but i don't see the same sort of
functionality in postgres.

The database is an archive of imformation, and i would like to do a cron'd
select for an interval based on the date.
I can get the current date.  But i don't know how to have the computer
properly figure out the past dates.

The select format has been:    SELECT blah FROM blah2        WHERE date BETWEEN (past_date) and (current_date);

This select is computed monthly.
And i do not want to have to change the variables every month when this
needs to run.  Nor do i think that i should have to result to perl
processing to solve this dilemma.  I have tried (i think) every possible
function and operation to try to get this to work.

The problem is trying to figure out whether an extra day should be added
for leap years. (It obviously should, but how do i tell the computer that
it should).  Postgres does not seem to recognize that concept well.

Since this is running monthly, if you have any ideas to form a select
like:SELECT _ WHERE date BETWEEN (date - 12 months) and ...
in other words, since postgres increments by day . . . is there anyway to get it to allow you to increment / decrement
by
month?

thanks in advance.
also for reading this (long winded) post.
.jtp



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Antw: plpgsql function gets wierd with Null parameters
Next
From: Thomas Lockhart
Date:
Subject: Re: Need Help With Dates.