commented on a Page, Show age and time until birthday  -  Oct 11, 2011

Cool Snippet, and on Jethros pointer of making it one alias as the two would only use the first one
I did this:

age { 
  var %b Oct 11 1887 10:00:00
  var %secs $calc($ctime - $ctime(%b $iif($regex(%b,\d\d:\d\d:\d\d),,00:00:00))) 
  var %years $calc(%secs /31556926) 
  var %nb $regsubex(%b,\d\d\d\d,$calc($date(yyyy) $iif($floor(%years) = $calc($date(yyyy) - $date($ctime(%b),yyyy)),+ 1,))) $iif($regex(%b,(\d\d:\d\d:\d\d)),,00:00:00) 
  $iif($1,me is ,say I am ) %secs seconds old which is %years years, in $duration($calc($ctime(%nb) - $ctime)) $me will be $calc($int(%years) +1) on %nb
}

Changed the set to var and used a $iff so say:
/age Returns

  • .iMaki is 659507236 seconds old which is 20.89897 years, in 5wks 1day 19hrs 32mins 44secs iMaki will be 21 on Nov 17 2011 10:00:00

and

/age
<.iMaki> I am 659507256 seconds old which is 20.89897 years, in 5wks 1day 19hrs 32mins 24secs iMaki will be 21 on Nov 17 2011 10:00:00

Any who nice work.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.