Community discussions

MikroTik App
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 92
Joined: Mon Apr 20, 2020 1:09 pm


Tue Jan 12, 2021 7:31 am

Hi guys,

can somebody please guide me on how to create a simple script with the date format as date/month/year for netwatch

the one I have is

:local CurDate [/system clock get date]
:local CurTime [/system clock get time]
:local HostName "Primary ISP link"
:local HostIP ""

:log info "$HostName $HostIP is UP"

/tool sms send lte1 "123455678" message="$HostName is UP at $CurTime $CurDate"

the sms that has such date format

Jan/01/1970 00:00:00

but I would like to get it as

01/Jan/1970 00:00:00

I tried to change it globally under clock settings but it doesn't let me change the date format to 01/Jan/1970 00:00:00

thank you
Forum Guru
Forum Guru
Posts: 6660
Joined: Mon Dec 04, 2017 9:19 pm


Tue Jan 12, 2021 10:37 am

There is no way to change the format of the date reported by RouterOS. You have to use string handling to change the order of components, for inspiration:

:local fulldate [system clock get date] ; :local dayOfMonth [:pick $fulldate 4 6] ; put $dayOfMonth

RouterOS uses fixed format for the day of month, so you do not need :find to determine the position of it in the date string.
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.

Who is online

Users browsing this forum: Baidu [Spider], Znevna and 213 guests