Community discussions

MikroTik App
 
faysalsy
just joined
Topic Author
Posts: 5
Joined: Tue Oct 01, 2019 6:53 pm

Fetch the number of days of the month

Sun Mar 13, 2022 10:25 pm

I want a script that fetches the number of days of the current month
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Fetch the number of days of the month  [SOLVED]

Sun Mar 13, 2022 11:35 pm

viewtopic.php?p=884256&hilit=month+days#p884256

Then you know how many days there are in february. The other months are always year the same.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Fetch the number of days of the month

Sat Mar 19, 2022 2:46 pm

viewtopic.php?f=9&t=75555#p876568

{
:local arrDaysOnMonths {jan="31";feb="28";mar="31";apr="30";may="31";jun="30";jul="31";aug="31";sep="30";oct="31";nov="30";dec="31"}
:if ((([:pick [/system clock get date] 7 11] - 1968) % 4) = 0) do={:set ($arrDaysOnMonths->"feb") 29}

:put "Days on this month: $($arrDaysOnMonths->[:pick [/system clock get date] 0 3])"
}

Who is online

Users browsing this forum: No registered users and 23 guests