Date:         Mon, 3 Apr 1995 09:42:58 -0400
Reply-To:     The NOMAD2 Discussion List
Sender:       The NOMAD2 Discussion List
From:         "Darrell R. Pitzer"
Subject:      Elapsed time

MaryLou,

The code that Stace provided (see attached) is correct. If you use it
with a start date of 4/3/77 and and end date of 4/3/95, you get the
correct result of 18 years, 0 days. I recently had to come up with code
for service calculations, and came up with the same sequence as Stace.

+-------------------------------------------+
| Darrell Pitzer                            |
| Exxon Research & Development Laboratories |
| Phone:  (504) 359-1130                    |
| Fax  :  (504) 359-8037                    |
| 'Net :  DARRELL.R.PITZER@EXXON.SPRINT.COM |
+-------------------------------------------+

 =============================================================================
  >>>  I thought there must me more to this than meets the eye, so I spent
  >>>  some more time. I dont get the results you were expecting, see the
  >>>  following code. Is it because 4/3/95 is a Monday?
  >>>
  >>>  define &sd          as date expr = '040377';
  >>>  define &ed          as date expr = '033095';
  >>>  define &yrs_service as 99   expr = int(interval(&sd,&ed,years));
  >>>  define &last_anniv  as date expr = addate(&sd,0,&yrs_service);
  >>>  define &dys_service as 999  expr = (&ed - &last_anniv);
  >>>  print  &last_anniv;
  >>>  print  &yrs_service;
  >>>  print  &dys_service;
  >>>
  >>>  returns:
  >>>
  >>>  &LAST_ANNIV=04/03/94
  >>>  &YRS_SERVICE=17
  >>>  &DYS_SERVICE=361
  >>>
  >>>  Stace Cameron
  >>>  Southern Illinois University - School of Medicine
  >>>  scameron@siumed.edu
  >>>

 =============================================================================
back to index