home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / fiasco_2.1 / arexx / age.frx next >
Text File  |  1997-09-22  |  1KB  |  41 lines

  1. /* age.frx
  2.  * ARexx script for calculating of the age using
  3.  * "Day of birth" and current date
  4.  * Copyright © 1995-1997 Nils Bandener
  5.  * $VER: age.frx 6.1 (22.9.97)
  6.  */
  7.  
  8. Options Results
  9.  
  10. GetField "DayOfBirth"               /* Insert here the field ID
  11.                                      * of the field, which contains
  12.                                      * the day of birth
  13.                                      */
  14.  
  15. Date = Result
  16.  
  17. Parse Var Date GDay "." GMonth "." GYear    /* ARexx makes parsing
  18.                                              * of the string
  19.                                              * very easy
  20.                                              */
  21.  
  22. Parse Value Date(European) With ADay "/" AMonth "/" AYear   /* The dateformat of
  23.                                                              * ARexx is a bit diffrent
  24.                                                              */
  25.  
  26. if length(GYear) <= 2 then GYear = GYear + 1900 /* Years with two digits are
  27.                                                  * supposed to be in
  28.                                                  * the 20th century
  29.                                                  */
  30. if length(AYear) <= 2 then AYear = AYear + 1900
  31.  
  32.  
  33. DYear = AYear - GYear
  34.  
  35. if GMonth > AMonth then DYear = DYear - 1
  36. else if GMonth = AMonth & GDay > ADay then DYear = DYear - 1
  37.  
  38. SetField "Age"  DYear               /* Insert here the correct field ID, too
  39.                                      */
  40.  
  41.