mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-01 08:44:32 +02:00
global-functions: introduce $ParseDate
The extra indention is intended for a later change.
This commit is contained in:
parent
e7927e0eee
commit
bafd71344d
1 changed files with 13 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
|||
:global LogPrintExit2;
|
||||
:global MkDir;
|
||||
:global NotificationFunctions;
|
||||
:global ParseDate;
|
||||
:global ParseKeyValueStore;
|
||||
:global PrettyPrint;
|
||||
:global RandomDelay;
|
||||
|
@ -682,6 +683,18 @@
|
|||
:set NotificationFunctions ({});
|
||||
}
|
||||
|
||||
# parse the date and return a named array
|
||||
:set ParseDate do={
|
||||
:local Date [ :tostr $1 ];
|
||||
|
||||
:local Months { "jan"=1; "feb"=2; "mar"=3; "apr"=4; "may"=5; "jun"=6;
|
||||
"jul"=7; "aug"=8; "sep"=9; "oct"=10; "nov"=11; "dec"=12 };
|
||||
|
||||
:return ({ "year"=[ :tonum [ :pick $Date 7 11 ] ];
|
||||
"month"=($Months->[ :pick $Date 0 3 ]);
|
||||
"day"=[ :tonum [ :pick $Date 4 6 ] ] });
|
||||
}
|
||||
|
||||
# parse key value store
|
||||
:set ParseKeyValueStore do={
|
||||
:local Source $1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue