http://forum.mikrotik.com/t/i-did-it-script-to-compute-unix-time/68576/1
You must calculate the weekday starting from one fixed date you know the right value, and calculating the day passed since that date,
including for each month add the right number of days, and 29 feb when is needed…
{
/system clock
:local strDate [get date]
:local intYear [:tonum [:pick $strDate 7 11]]
:local strMonth [:pick $strDate 1 3]
:local intDay ([:tonum [:pick $strDate 4 6]] - 1)
:local arrPreMonDays {an=0;eb=31;ar=59;pr=90;ay=120;un=151;ul=181;ug=212;ep=243;ct=273;ov=304;ec=334}
# 1970-01-01 is a Thursday
:local arrWeekDays {"Thu";"Fri";"Sat";"Sun";"Mon";"Tue";"Wed"}
# first bixestile year just before 1970 is 1968
:local numTotalDays (($intYear - 1968) / 4)
:if ((($intYear - 1968) % 4) = 0) do={:set ($arrPreMonDays->"an") -1; :set ($arrPreMonDays->"eb") 30}
:set numTotalDays ($numTotalDays + (($intYear - 1970) * 365))
:set numTotalDays ($numTotalDays + ($arrPreMonDays->$strMonth))
:set numTotalDays ($numTotalDays + $intDay)
:local strWeekDay ($arrWeekDays->($numTotalDays % 7))
:put "Week Day is $strWeekDay"
}
(EDIT later: upgraded version of this script http://forum.mikrotik.com/t/changing-the-mmm-dd-yyyy-date-format/5183/10 )
This calculation isn’t accurate before Jan/01/1970, because I took this snippet from the code that calculates the unix epoch,
and it isn’t accurate after Feb/28/2100 because I didn’t consider the correction for leap day on century.
REFRESHED for 7.10+
http://forum.mikrotik.com/t/date-parts-weekday/162769/1
Full version of this script: http://forum.mikrotik.com/t/changing-the-mmm-dd-yyyy-date-format/5183/10