Search Postgresql Archives

Dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux