Hello, I'm currently just looking for a simple way to calculate the duration between two set dates. Currently mIRC's internal $duration only calculates up to weeks. Though, I'm sure it could easily incorprate months and years since the standard month is 30 days, and a year is standard as 365 days.

I've tryed unseccesfully to produce my own short script to do this, and I'm looking for any suggestions, improvements, etc.

Code:
until { 
  var %duration = $duration($round($calc(($ctime($3 $1 $2 $iif($4,$4 $+ :00,00:00:00)) - $ctime)),2))
  var %until = $1-
  tokenize 32 %duration
  if (*wks iswm $1) && ($remove($1,wks) >= 4) {
    %weeks = $remove($1,wks)
    if (%weeks >= 52) { var %years = $round($calc(%weeks / 52),0) }
    var %months = $calc((%weeks / 4) - (%years * 12))
    var %weeks = $round($calc($chr(26) $+ $gettok(%months,2,46) * 4),0)
  }
  var %duration = %years $+ $iif(%years > 1,yrs,yr) %months $+ $iif(%months > 1,mth,mths) %weeks $+ $iif(%weeks > 1,wks,wk) $remove(%duration,$1)
  say There is %duration until %until 
}


I know it's not the best looking code. :x


Live to Dream & Dream for Life