Search Postgresql Archives

Re: [SQL] function to find difference between in days between two dates

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

 



Hello

PostgreSQL hasn't any official function for it. If you need it, you
can write own function

CREATE FUNCTION date_diff(date, date) returns integer as $$
select $1-$2; $$ language sql;

Regards
Pavel Stehule

2007/6/14, Ashish Karalkar <ashish.karalkar@xxxxxxxxxxxxxxxxx>:


Hello all,

Is there any function to find  differences in days between two dates?


I am using

select abs(current_date - '2007-06-15')

to get the desired result.
but I think there must be a function and I am missing it,
if so, can anybody please point me to that.


Thanks in advance

With regards
Ashish Karalkar





[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