Re: Date Difference

From: Lyle B Tiffany <lbt_at_terminator.rs.itd.umich.edu>
Date: 11 May 1994 15:46:13 -0400
Message-ID: <2qrcm5$rcu_at_terminator.rs.itd.umich.edu>


In article <19940511151534.mehta_at_mehta.bms.com>, Prej Mehta <mehta_at_bms.com> wrote:

:Sorry if this is a FAQ. My problem is of doing a difference on dates. The
:dates may be less than 1 month, in which case I need the difference in days,
:else I need the difference in months. Can anyone suggest the easiest way
:of doing this. The dates will be entered via SQLFORMS V3, for a V6 engine.
:Please post replys to me at mehta_at_bms.com. Thanks in advance.

Use TO_CHAR(date, 'J'). This gives "Julian" days since December 31, 4713 B.C. If you find difference of days > 30, then divide the difference by average days in a month. That's plain simple.

LBT.

-- 
Bernard Tiffany                      Bitnet: USERW062_at_UMICHUM 
Internet: Bernard.Tiffany_at_umich.edu  CompuServe: 75046.2667 
Windows is no longer a trademark of Microsoft Corporation.
Received on Wed May 11 1994 - 21:46:13 CEST

Original text of this message