#daysbetween()
DESCRIPTION
returns the number of days between two date values
SYNOPSIS
#daysbetween(d1,d2)
ARGUMENTS
d1 - a datevalue, or datevalue expression
d2 - a datevalue, or datevalue expression
EXAMPLES
QueuedMailOld
init
status active
level warning
task "Report old messages in the mail queue"
input proc "=mailq"
filter "=egrep '^[A-Z]' | =awk 'NF==7'"
dat $ident 1
dat #size 2
dat $dow 3
dat $mon 4
dat #date 5
dat $time 6
dat $sender 7
begin
set #timenow = #now()
set #yr = #year()
rule
set #mn = #monthnumber($mon)
set #msgage = #daysbetween(#datevalue(#yr, #mn, #date), #timenow)
rule // dispose of possible ending "*" in ident
if $right($ident,1) eq "\*"
set $ident2 = $chop($ident)
else
set $ident2 = $ident
endif
rule // delete after 7 days
if #msgage > 7
=execwait "=rm =mqueue\/\*$substring($ident2,2)\*"
next
endif
rule // warn after 5 days
if #msgage > 5
|| #msgage < 0 // at turn of year
output mail "old: $inline"
endif
SEE ALSO
Numerical Functions
String Functions