X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 821AC564D1 for ; Sat, 26 Feb 2005 21:00:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84349-02 for ; Sat, 26 Feb 2005 21:00:32 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id BA90A566BB for ; Sat, 26 Feb 2005 21:00:38 +0000 (GMT) Received: (qmail 4596 invoked by uid 500); 26 Feb 2005 21:16:10 -0000 Date: Sat, 26 Feb 2005 15:16:10 -0600 From: Bruno Wolff III To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: diference in dates in minutes Message-ID: <20050226211610.GA4472@wolff.to> Mail-Followup-To: Joel Fradkin , pgsql-sql@postgresql.org References: <20050226180108.GB26473@wolff.to> <000401c51c3f$b82188d0$797ba8c0@jfradkin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401c51c3f$b82188d0$797ba8c0@jfradkin> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/328 X-Sequence-Number: 20438 On Sat, Feb 26, 2005 at 15:14:02 -0500, Joel Fradkin wrote: > You probably want to convert the dates to timestamps, subtract them to > get an interval, extract the epoch to get timme in seconds and then divide > by 60 to get time in minutes. > > The converting date to timestamp part isn't trivial. You need to decide > on what you mean when you do this. If you really have timestamps in the > first place, then you can skip the covernsion step. > > They are dates and I did find I could do date - date to give me an interval > date_part('epoch',date-date) returns in secs so /60 date - date won't give you an interval, it will give you an integer of some sort. > This appeared to work ok without converting to time stamps, but maybe I am > missing it if it is not correct as the example I looked at was a large > difference. The app is analyzing Tlogs and the difference should never be > too large, so I will further analyze it with real data. > As always I appreciate the help. > My real question is this an interval then and will it be depreciated soon? The Interval type won't be depreciated. Using to_char to convert intervals to strings is being depreciated. This won;t cause a problem for extract or similar functions.