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 8DDB752AA9 for ; Mon, 28 Feb 2005 15:09:15 +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 21427-02 for ; Mon, 28 Feb 2005 15:09:06 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id B7525564E6 for ; Mon, 28 Feb 2005 15:09:04 +0000 (GMT) Received: (qmail 17744 invoked by uid 500); 28 Feb 2005 15:24:41 -0000 Date: Mon, 28 Feb 2005 09:24:41 -0600 From: Bruno Wolff III To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: diference in dates in minutes Message-ID: <20050228152441.GA16739@wolff.to> Mail-Followup-To: Joel Fradkin , pgsql-sql@postgresql.org References: <20050227055354.GA16299@wolff.to> <000001c51d9f$1386bcd0$797ba8c0@jfradkin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c51d9f$1386bcd0$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/351 X-Sequence-Number: 20461 On Mon, Feb 28, 2005 at 09:09:09 -0500, Joel Fradkin wrote: > Yea I probably forgot respond to all. I agree (specialy for this topic). > > In any case, I have dates not time (dates with times). It really helps if you use precise language when discussing problems. date, time with time zone, time without time zone, timestamp with time zone, and timestamp without time zone are all different types. > I did not use datevar::date - date2::date, I did datevar - datevar2 and it > appeared to work. That can not give you a result that is an interval if datevar and datevar2 are actually dates. They must be some other type, probably a timestamp of some sort. > Since the dates I was comparing were over a year apart the number in secs > was hard to verify. Soon as I get to debuggin the actual app where the time > dif will be a few minutes I will let you know if it worked to do the > date_part('epoch',date-date) returns in secs so /60. If the date variables are of type timestamp with time zone you should be OK. You probably want to test comparing dates in different time zones (if you have different time offsets from GMT at different times of the year at your locale, e.g. daylight savings vs standard time) to make sure you get the expected result.