function for date difference ?

Started by jpremalmost 26 years ago2 messagesgeneral
Jump to latest
#1jprem
jprem@srmsoft.co.in

hello ,

is there any built-in function to find the difference between any two
dates
in postgresql 6.5.3 ?

#2Stephane Bortzmeyer
bortzmeyer@pasteur.fr
In reply to: jprem (#1)
Re: function for date difference ?

On Friday 30 June 2000, at 14 h 54, the keyboard of jprem <jprem@srmsoft.co.in>
wrote:

is there any built-in function to find the difference between any two
dates in postgresql 6.5.3 ?

You can do substraction on dates.

SELECT ending - starting FROM intervals;
SELECT * FROM intervals WHERE ending - starting > 86400::timespan;

If you want something more sophisticated, you have to read the dates into a
program (I do it with Perl) and use this program to perform all the operations
you wish.