three days before a date to send e-mail

hello
is it possible make router understand a date to do some thing before another date that i put in script for example
the date i put is dec/26/2016 then automatic it should do another thing before three days of that date

this is my script it is working but i do’nt want to change the date of sending email to user every time i set the date of disabling his

/queue simple { 
#acc info
       :local uName "aaa"
       :local accname "a person"
       :local uemail "a@hotmail.com"
#price
 :local uprice "200 usd"
       :local uList [find name=$uName]
       :foreach u in=$uList do={
#original speed in queue
 set $u burst-limit=356352/5242880 burst-threshold=356352/5242880 burst-time=\
 5s/5s max-limit=356352/5242880 limit-at=356352/5242880  
     } 
       :log warning "$uName limits has been reset"
       :global idate value=[/system clock get value-name=date]
#disable acc date
 :if ($idate = "jan/02/2017") do={ 
       /ip hotspot ip-binding {
       :local ui 10.0.0.211
       :local uiList [find address=$ui]
       :foreach uii in=$uiList do={
       set $uii disabled=yes 
       }
       :log error "$uName has been Disabled"
       }} else={
 
#send email date
 :if ($idate = "dec/31/2016") do={
       /tool e-mail { 
       send to="$uemail" subject="ÝÇÊæÑÉ ÓÏÇÏ ÈíæÑäÊ" body="    $idate    dear user  
                                                $accname     
        we want to inform you .... etc

                                   "

        }
       :log warning "$uName near disable an E-mail sent to $uemail"
       }
       }
       }

Are you really trying to implement your customer invoicing in RouterOS scripts???

not trying i already do

?!

I think it is a bad idea… but maybe eventually you will succeed.
The standard way of handling this problem is to first convert the date into a linear increasing
number like “seconds since 1/1/1970” or “days since …”, then subtract or add whatever number
of days you want as the offset, then convert back to the representation you like (when required).
That way you avoid all the hassle of month lengths and wraparounds.
But of course your scripting language has to be powerful enough to have that kind of conversion
functions or the possibility to write them as subroutines.

sound complex maybe i leave it as it is then

I think it is a bad idea…

what u mean could u explain plz why it is bad

It is bad because you will hit limitations of the scripting language all the time, and you will
spend a lot of time working around them. RouterOS scripts are often useful to perform simple
tasks but I would not try anything like this, unless the entire system is little more than a toy.

so far no problem at all my routerboard is ccr1009 8g-1s-1s+ if there is an alternative i would

Of course there is an alternative. Get a separate system running the OS of your choice,
with mail software, a database, and some application development platform. Then let this
system do all the work, getting the info from the routers using SNMP or MikroTik API.

ammm it could be done by mikrotik script only