pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Sawtell <csawtell@xtra.co.nz>
To: Jackie Siu <spjackie@polyu.edu.hk>
Cc: pgsql-sql@postgresql.org
Subject: Re: day difference
Date: Sat, 30 Jun 2001 16:14:49 +1200
Message-ID: <3B3D5239.2DD48DB0@xtra.co.nz> (raw)
References: <9h12ft$1gpg$1@news.tht.net>

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



view thread (3+ messages)

Message-ID: <3B3D5239.2DD48DB0@xtra.co.nz>
Permalink:  ../3B3D5239.2DD48DB0@xtra.co.nz/
Also on:    postgresql.org/message-id/3B3D5239.2DD48DB0@xtra.co.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: csawtell@xtra.co.nz, spjackie@polyu.edu.hk
  Subject: Re: day difference
  In-Reply-To: <3B3D5239.2DD48DB0@xtra.co.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox