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 D60393A45E6 for ; Tue, 25 Jan 2005 19:03: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 06238-02 for ; Tue, 25 Jan 2005 19:03:31 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 85A913A57C4 for ; Tue, 25 Jan 2005 19:03:30 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j0PJ3L5Q006063; Tue, 25 Jan 2005 22:03:21 +0300 (MSK) Date: Tue, 25 Jan 2005 22:03:21 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Joel Fradkin Cc: "'Achilleus Mantzios'" , pgsql-sql@postgresql.org Subject: Re: datediff is there something like it? In-Reply-To: <000201c50306$e9c1b380$797ba8c0@jfradkin> Message-ID: References: <000201c50306$e9c1b380$797ba8c0@jfradkin> MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.678 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, URIBL_SBL X-Spam-Level: Content-Type: TEXT/PLAIN; charset=koi8-r; format=flowed Content-Transfer-Encoding: 8BIT X-Archive-Number: 200501/234 X-Sequence-Number: 20022 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---559023410-912437380-1106679801=:6363 Content-Type: TEXT/PLAIN; charset=koi8-r; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 25 Jan 2005, Joel Fradkin wrote: > Yes I am using datepart, but not seeing how with a datediff. > Maybe I just need to do the date math and put a date part on the result. > I will play around a bit when I hit one not looking for days. > http://www.pgsql.ru/db/pgsearch/index.html?q=datediff > 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. > ¿ 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. > > > > > -----Original Message----- > From: Achilleus Mantzios [mailto:achill@matrix.gatewaynet.com] > Sent: Tuesday, January 25, 2005 11:34 AM > To: Joel Fradkin > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] datediff is there something like it? > > 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. >> >> >> >> >> >> >> >> >> > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 ---559023410-912437380-1106679801=:6363--