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 302C13A5578 for ; Tue, 25 Jan 2005 15:57:41 +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 78206-01 for ; Tue, 25 Jan 2005 15:57:27 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 10A473A5762 for ; Tue, 25 Jan 2005 15:57:28 +0000 (GMT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id j0PGXUcN000370; Tue, 25 Jan 2005 18:33:30 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id j0PGXUF2000366; Tue, 25 Jan 2005 18:33:30 +0200 Date: Tue, 25 Jan 2005 18:33:30 +0200 (EET) From: Achilleus Mantzios To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: datediff is there something like it? In-Reply-To: <000001c502f0$2d10a7c0$797ba8c0@jfradkin> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/215 X-Sequence-Number: 20003 O Joel Fradkin έγραψε στις Jan 25, 2005 : > Hi all working my way through our views and all is going very well. > > We use datediff in MSSQL a bit and I read about the field1::date - > field2::date to return the days numerically. > > Is there any way to get months and years besides guessing days / 30 for > months etc? Go to http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html Check out smth like... SELECT 'Achilleus is ' || date_part('years',age(timestamp '1969-01-31')) || ' years and ' || date_part('months',age(timestamp '1969-01-31')) || ' months old'; ?column? ----------------------------------------- Achilleus is 35 years and 11 months old (1 row) > > > > Joel Fradkin > > > > Wazagua, Inc. > 2520 Trailmate Dr > Sarasota, Florida 34243 > Tel. 941-753-7111 ext 305 > > > > 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. > > > > > > > > > -- -Achilleus