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 95BF85663C for ; Mon, 28 Feb 2005 14:05:13 +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 03517-02 for ; Mon, 28 Feb 2005 14:05:03 +0000 (GMT) Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by svr1.postgresql.org (Postfix) with ESMTP id 141FD564D7 for ; Mon, 28 Feb 2005 14:05:02 +0000 (GMT) Received: from jfradkin ([66.15.127.235]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ICM00J8GKGHDT30@vms044.mailsrvcs.net> for pgsql-sql@postgresql.org; Mon, 28 Feb 2005 08:05:06 -0600 (CST) Date: Mon, 28 Feb 2005 09:09:09 -0500 From: "Joel Fradkin" Subject: Re: diference in dates in minutes In-reply-to: <20050227055354.GA16299@wolff.to> To: "'Bruno Wolff III'" Cc: Message-id: <000001c51d9f$1386bcd0$797ba8c0@jfradkin> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.147 tagged_above=0 required=5 tests=AWL, MSGID_DOLLARS X-Spam-Level: *** X-Archive-Number: 200502/353 X-Sequence-Number: 20463 Yea I probably forgot respond to all. I agree (specialy for this topic). In any case, I have dates not time (dates with times). I did not use datevar::date - date2::date, I did datevar - datevar2 and = it appeared to work. 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=20 date_part('epoch',date-date) returns in secs so /60. I appreciate your help and concern, it will be very important to us to ensure we can do the proper calculations. Joel Fradkin =20 Wazagua, Inc. 2520 Trailmate Dr Sarasota, Florida 34243 Tel. 941-753-7111 ext 305 =20 jfradkin@wazagua.com www.wazagua.com Powered by Wazagua Providing you with the latest Web-based technology & advanced tools. C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc This email message is for the use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized = review, use, disclosure or distribution is prohibited. If you are not the = intended recipient, please contact the sender by reply email and delete and = destroy all copies of the original message, including attachments. =20 =20 -----Original Message----- From: Bruno Wolff III [mailto:bruno@wolff.to]=20 Sent: Sunday, February 27, 2005 12:54 AM To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] diference in dates in minutes Discussions along this line should stay on the list so that other people can learn from and add comments to the discussion. On Sat, Feb 26, 2005 at 16:57:15 -0500, Joel Fradkin wrote: > You sure? > I thought date1::date - date2::date returns an integer of day's diff, = but > date -date returns an interval (least I can do a to_char on it and see day's > hours etc that were correct. Then your "date" column is most likely a timestamp, not a date. That is what you want anyway if you are trying to get a time difference in = minutes. That wouldn't make much sense for dates. > Why are they depreciating the ability to look at an interval as a = string > anyhow? Is there an approved method of looking at an interval as a = string > replacing it? I think because the current version does some odd things and no one has = put together a spec to replace it. You can ge formatted output using EXTRACT and suitable further manipulation. >=20 > Joel Fradkin > =20 > Wazagua, Inc. > 2520 Trailmate Dr > Sarasota, Florida 34243 > Tel. 941-753-7111 ext 305 > =20 > jfradkin@wazagua.com > www.wazagua.com > Powered by Wazagua > Providing you with the latest Web-based technology & advanced tools. > C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc > This email message is for the use of the intended recipient(s) and = may > contain confidential and privileged information. Any unauthorized = review, > use, disclosure or distribution is prohibited. If you are not the intended > recipient, please contact the sender by reply email and delete and = destroy > all copies of the original message, including attachments. > =20 >=20 > =20 >=20 > -----Original Message----- > From: Bruno Wolff III [mailto:bruno@wolff.to]=20 > Sent: Saturday, February 26, 2005 4:16 PM > To: Joel Fradkin > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] diference in dates in minutes >=20 > 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. > >=20 > > 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. > >=20 > > They are dates and I did find I could do date - date to give me an > interval=20 > > date_part('epoch',date-date) returns in secs so /60 >=20 > date - date won't give you an interval, it will give you an integer of some > sort. >=20 > > 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? >=20 > 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. >=20