Thread: Re: DateDiff in PostgreSQL
Hi, You can use the age() function to find the difference between dates, and use the extract() function to get the years, months, days, etc. Yasir On Fri, 7 Nov 2003, George A.J wrote: > Date: Fri, 7 Nov 2003 05:34:09 -0800 (PST) > From: George A.J <jinujosein@yahoo.com> > To: pgsql-sql@postgresql.org > Subject: [SQL] DateDiff in PostgreSQL > > > Hi, > > i am converting a MSSQL Server database to PostgreSQL. > > Using PostgreSQL version 7.3.2. > > Is there any function like the DateDiff() in MSSQL Server. > > ie, a function that returns difference of two dates(timestamp) in days or months or year.. > > The - operator for timestamp retuns the intervel in days only. > > Please help > > jinujose > > > --------------------------------- > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard
Yasir Malik <ymalik@heineken.cs.stevens-tech.edu> wrote:
>You can use the age() function to find the difference between dates, and
>use the extract() function to get the years, months, days, etc.
>Yasir
this will not work because age('25/12/1975','30/01/1986')
wil return '10 year 1 month 5 days'
extract only returns years -10, moths-1, days-5.
this is not i want.Actual month difference between the dates are 121 months.
jinu jose
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard