Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: How to...? Convert Date of Birth to Age

From: lmecir:mbox:vol:cz at: 3-Jul-2002 11:41

Hi Andrew, There is a possibility to write the function as follows: age: function [birth [date!] date [date!]] [years months days new] [ if date < birth [ return head insert age date birth '- ] days: date/day - birth/day if negative? days [ months: birth/month + 1 years: birth/year if months > 12 [ months: 1 years: years + 1 ] new: to date! reduce [1 months years] days: new - birth + date/day - 1 birth: new ] months: date/month - birth/month years: date/year - birth/year if negative? months [ months: months + 12 years: years - 1 ] reduce [years months days] ] -L