All pastes #586061 Raw Edit

Age

public text v1 · immutable
#586061 ·published 2007-06-23 16:47 UTC
rendered paste body
; By: FuIru
;
; Date format: Month {MMM} Day {DD} Hour:Minute:Second {HH:MM:SS} Year {YYYY}
; this is put into the FIRST LINE

; example first line: if ($1 == $null) { var %dob = Jun 29 03:30:00 1988 }

; Add this to your "alias" tab on the script editor to load :)

age {
  if ($1 == $null) { var %dob = MMM DD HH:MM:SS YYYY }
  else { var %dob = $1- }
  var %dob.day = $left(%dob,6)
  var %dob.year = $right(%dob,4)
  var %dob.left = $left(%dob, 15)
  var %bday.next = $ctime(%dob.left $asctime(yyyy))
  var %currtime = $ctime
  var %age = $round($calc($int($asctime(yyyy)) - $int(%dob.year)),5)
  if (%bday.next < %currtime) {
    var %bday.next = $ctime(%dob.left $calc($asctime(yyyy)+1))
  } 
  else {
    dec %age 1
  }
  var %next = $duration($calc((%bday.next )-(%currtime)))
  describe $active is %age and will be $calc($int(%age)+1) in %next
}