/clndr

By _dead on Apr 17, 2007

Type /clndr and see the days of the month

alias clndr {
  set %d 1
  set %m $asctime(mm)
  set %y $asctime(yyyy)
  echo -a 0,4 $+(,$month($gettok($asctime($ctime($+(%d,/,%m,/,%y))),2,32)),) 
  :1
  if ($isdate($+(%d,/,%m,/,%y)) == 1) {
    if ($gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32) == Mon) { echo -a $gettok($asctime($ctime($+(%d,/,%m,/,%y))),3,32) $str( $chr(32),10) $+(3,$gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32),) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),2,32) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),5,32) | goto 2 }
    if ($gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32) == Sat) { echo -a $gettok($asctime($ctime($+(%d,/,%m,/,%y))),3,32) $str( $chr(32),10) $+(4,$gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32),) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),2,32) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),5,32) | goto 2 }
    if ($gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32) == Sun) { echo -a $gettok($asctime($ctime($+(%d,/,%m,/,%y))),3,32) $str( $chr(32),10) $+(4,$gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32),) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),2,32) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),5,32) | goto 2 }
    echo -a $gettok($asctime($ctime($+(%d,/,%m,/,%y))),3,32) $str( $chr(32),10) $+(1,$gettok($asctime($ctime($+(%d,/,%m,/,%y))),1,32),) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),2,32) $str( $chr(32),10) $gettok($asctime($ctime($+(%d,/,%m,/,%y))),5,32) 
    :2
    inc %d 
    goto 1 
  }
  else echo -a End of $+(,$month($gettok($asctime($ctime($+($calc(%d -1),/,%m,/,%y))),2,32)),) | halt
}
alias isdate {
  if $count($1,/,.,+) = 2 tokenize 47 $1
  return $iif($1 isnum 1- $iif($2 = 2,$iif(4 // $3 && 25 \\ $3 || 16 // $3,29,28),$iif($or($2,6) isin 615,30,31)) && $2 isnum 1-12 && 1 // $3,1,0)
}
alias month {
  if ($1 == 1) { return Jannuary }
  if ($1 == 2) { return February }
  if ($1 == 3) { return March }
  if ($1 == 4) { return April }
  if ($1 == 5) { return May }
  if ($1 == 6) { return June }
  if ($1 == 7) { return July }
  if ($1 == 8) { return August }
  if ($1 == 9) { return September }
  if ($1 == 10) { return Octomber }
  if ($1 == 11) { return November }
  if ($1 == 12) { return December }
  if ($1 == Jan) { return Jannuary }
  if ($1 == Feb) { return February }
  if ($1 == Mar) { return March }
  if ($1 == Apr) { return April }
  if ($1 == May) { return May }
  if ($1 == Jun) { return June }
  if ($1 == Jul) { return July }
  if ($1 == Aug) { return August }
  if ($1 == Sep) { return September }
  if ($1 == Oct) { return Octomber }
  if ($1 == Nov) { return November }
  if ($1 == Dec) { return December }
}

Comments

Sign in to comment.
RusselB   -  Apr 21, 2007

Month alias could be quite a bit shorter, and (small thing) January only has one n in it, also October doesn\'t have an m.

 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.