X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D42EDD1B540 for ; Fri, 7 Nov 2003 13:50:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 15519-01 for ; Fri, 7 Nov 2003 09:50:17 -0400 (AST) Received: from serwer.skawsoft.com.pl (rtr.skawina.eu.org [80.48.213.10]) by svr1.postgresql.org (Postfix) with ESMTP id 8FF07D1B54B for ; Fri, 7 Nov 2003 09:50:12 -0400 (AST) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id AA5342B3CB; Fri, 7 Nov 2003 14:49:13 +0100 (CET) Message-ID: <3FABA26D.5030900@klaster.net> Date: Fri, 07 Nov 2003 14:47:25 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5) Gecko/20030916 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: "George A.J" Cc: pgsql-sql@postgresql.org Subject: Re: DateDiff in PostgreSQL References: <20031107133409.25844.qmail@web14909.mail.yahoo.com> In-Reply-To: <20031107133409.25844.qmail@web14909.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/40 X-Sequence-Number: 15855 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