Received: from mta4-rme.xtra.co.nz (mta4-rme.xtra.co.nz [203.96.92.15]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5U4Eda81845 for ; Sat, 30 Jun 2001 00:14:40 -0400 (EDT) (envelope-from csawtell@xtra.co.nz) Received: from xtra.co.nz ([210.55.121.93]) by mta4-rme.xtra.co.nz with ESMTP id <20010630042248.IKJY2547522.mta4-rme.xtra.co.nz@xtra.co.nz>; Sat, 30 Jun 2001 16:22:48 +1200 Message-ID: <3B3D5239.2DD48DB0@xtra.co.nz> Date: Sat, 30 Jun 2001 16:14:49 +1200 From: Christopher Sawtell Organization: At Home X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.15-4mdk i586) X-Accept-Language: en MIME-Version: 1.0 To: Jackie Siu CC: pgsql-sql@postgresql.org Subject: Re: day difference References: <9h12ft$1gpg$1@news.tht.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200106/474 X-Sequence-Number: 3777 Jackie Siu wrote: > > Hi, > > Is there exist a function to calculate day difference between two date. For > example: select functionx('1JAN2001','5FEB2001') from abc where .... Then it > returns 36 (days). Thanks for your help. chris=# select ('5feb2001'::date - '1jan2001'::date) as "Days Difference"; Days Difference ----------------- 35 (1 row) chris=# select version(); version --------------------------------------------------------------- PostgreSQL 7.1.1 on i586-pc-linux-gnu, compiled by GCC 2.95.3 (1 row) -- Sincerely etc., NAME Christopher Sawtell CELL PHONE 021 257 4451 ICQ UIN 45863470 EMAIL csawtell @ xtra . co . nz CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz -->> Please refrain from using HTML or WORD attachments in e-mails to me <<--