Re: Dates

From: MaRCeLO PeReiRA <gandalf_mp(at)yahoo(dot)com(dot)br>
To: Andrew Rawnsley <ronz(at)ravensfield(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dates
Date: 2004-02-16 20:05:52
Message-ID: 20040216200552.38415.qmail@web20201.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Andrew, and other ones,

It was exactly what I was looking for!!

Thanks!!

Regards,

Marcelo

Ps.: This is the fastest and more efficient mailing
list in the world. Congratulations to all.

--- Andrew Rawnsley <ronz(at)ravensfield(dot)com> escreveu:
>
> Subtracting two dates/timestamps will return an
> interval. So
>
> select now()::date - '2004-01-13'::date
>
> returns 34.
>
> Is this what you need?
>
> On Feb 16, 2004, at 2:01 PM, MaRCeLO PeReiRA wrote:
>
> > Hi Guys,
> >
> > I am in troubles with some dates.
> >
> >
> > "I need to know the difference, in days, between
> two
> > dates."
> >
> > Well, if the difference is less than a month, so I
> > could use:
> >
> > SELECT date_part('day', age(now(), mydate));
> >
> > But, when it is bigger than a month, the select
> above
> > return a wrong information to me:
> >
> > For instance:
> >
> > intranet=# select age('30/01/2004', '01/03/2004');
> > age
> > -----------------------
> > @ 1 mon 2 days 1 hour
> >
> > So, if I use date_part(), it would return "2
> days",
> > not "31 days", that is what I was waiting for.
> >
> > How can I get the difference, in days, between two
> > dates???
> >
> > Thanks in advance and
> > Best Regards,
> >
> >
> >
> >
>
______________________________________________________________________
> >
> > Yahoo! Mail - O melhor e-mail do Brasil! Abra sua
> conta agora:
> > http://br.yahoo.com/info/mail.html
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 8: explain analyze is your friend
> >
> --------------------
>
> Andrew Rawnsley
> President
> The Ravensfield Digital Resource Group, Ltd.
> (740) 587-0114
> www.ravensfield.com
>

______________________________________________________________________

Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora:
http://br.yahoo.com/info/mail.html

In response to

  • Re: Dates at 2004-02-16 19:53:13 from Andrew Rawnsley

Browse pgsql-general by date

  From Date Subject
Next Message Antonios Christofides 2004-02-16 20:19:06 Cascade delete triggers change user credentials
Previous Message Andrew Rawnsley 2004-02-16 19:53:13 Re: Dates