pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John <john@akadine.com>
To: pgsql-sql@postgreSQL.org
Subject: Need Help With Dates.
Date: Mon, 3 Jul 2000 13:40:44 -0400 (EDT)
Message-ID: <Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com>
Permalink:  ../Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com/
Also on:    postgresql.org/message-id/Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: john@akadine.com
  Subject: Re: Need Help With Dates.
  In-Reply-To: <Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com>
  References: <Pine.BSF.4.21.0007031319280.9180-100000@db.akadine.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox