home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / CLIPPER / NCCLIB.ZIP / NCCCODE.ZIP / YEARMTHS.PRG < prev   
Text File  |  1992-11-04  |  925b  |  25 lines

  1. //═══════════════════════════════════════════════════════╕
  2. //  Program .....: Yearmths                              │
  3. //  CopyRight ...: 1992 National Computer Consultants    │
  4. //                 All rights are reserved.              │
  5. //  Author ......: Greg Rice                             │
  6. //═══════════════════════════════════════════════════════╛
  7.  
  8.  
  9. //───────────────────────────────────────┐
  10. // Function...: years_mths()             │
  11. // Syntax.....: years_mths(<exp>)        │
  12. //        ----  <exp> = Number of months │
  13. //───────────────────────────────────────┘
  14.  
  15. Function years_mths(x_num)
  16.  
  17.     local no_years, dot, x_years, x_months
  18.  
  19.     no_years := ltrim(str(x_num / 12,10,2))
  20.     dot      := AT(".", no_years)
  21.     x_years  := substr(no_years, 1, dot - 1)
  22.     x_months := ltrim(str((val(substr(no_years, dot + 1)) * 12) / 100, 1))
  23.  
  24. Return( x_years + " years and " + x_months + " months." )
  25.