Re: day difference

From: Christopher Sawtell <csawtell(at)xtra(dot)co(dot)nz>
To: Jackie Siu <spjackie(at)polyu(dot)edu(dot)hk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: day difference
Date: 2001-06-30 04:14:49
Message-ID: 3B3D5239.2DD48DB0@xtra.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 <<--

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2001-06-30 11:49:16 Re: creating variable views
Previous Message Dado Feigenblatt 2001-06-29 19:29:33 creating variable views