date calculations

Lerebours, Jose Jose.Lerebours at EagleGL.com
Wed Mar 23 13:39:55 PST 2005


Rachel posted:

> 
> I am new to this site. I learned Filepro around 15 years ago, 
> however, I have not used it for the last 5 years. My brain is 
> EXTREMELY foggy....... Can someone tell me how to calculate 
> the number of months that have passed since a certain date? 
> I'm writing an input processing and am trying to calculate 
> the number of months an individual has been employed with a 
> company. I'm am sure this is quite simple, but my simple 
> little brain is tied up in knots trying to figure out how to 
> write this! I'd appreciate anyone's help! Thx! Rachel 
> 

Welcome!

Well, you can do it the quick and dirty way and gamble on
been off a month (+/-)

or

You can start with the starting date and add one month
at a time, check the resulting date against your ending
date.  Say  da is your start date, db is your months
and dc is you ending date and lets have dd & de for kicks

then: da(8,mdy/)="01/01/80" ; dc(8,mdy/)=@td ; de(8,.0)
LOOP:
then: dd(8,mdy/)=addmonth(da,"1")
  if: dd gt dc
then: de=@td-da ; goto GOTIT
then: db(5,.0)=db+"1" ; da=dd ; goto LOOP
GOTIT:if:
   :then: show "@Months:"&db&" and "&de&" days." ; end

Something like this should get the job done or at least point
you in the general direction.  Just one way to skin the cat.

NOTE:  I just put this up without testing.  I did not even
look at it twice so please, due diligence is recommended.

Good luck!


Jose Lerebours


More information about the Filepro-list mailing list