Re: DateDiff in PostgreSQL - Mailing list pgsql-sql

From Tomasz Myrta
Subject Re: DateDiff in PostgreSQL
Date
Msg-id 3FABA26D.5030900@klaster.net
Whole thread Raw
In response to DateDiff in PostgreSQL  ("George A.J" <jinujosein@yahoo.com>)
List pgsql-sql
Dnia 2003-11-07 14:34, Użytkownik George A.J napisał:
> 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.

1. You can convert timestamps to dates and then substract them. The 
result will be days::integer.

2. Interval result is not a problem - you can extract epoch from it. The 
result is seconds::integer - do whatever you want with it.

Regards,
Tomasz Myrta



pgsql-sql by date:

Previous
From: Yasir Malik
Date:
Subject: Re: DateDiff in PostgreSQL
Next
From: "George A.J"
Date:
Subject: Re: DateDiff in PostgreSQL