Hello to all
for project I need special sintax in http get request to server. I use fetch tool on MT but I need time and date from MT in special format understandable for server like this:
date,time example 300918,202130 (this is how remote server understand)
Where:
300918 = 30.sep.2018.
202130 = 20h 21min 30sec
I modify for better use (adding “-”) but… how i can replace on 1-9 months before month number zero?
Example:
Now: 2022-2-15_-10-32-16
I want: 2022-02-15-_10-32-16
# BEGIN Script v2
# BEGIN Config
# END Config
:local Date [/system clock get date]
:local Time [/system clock get time]
:local Month [:tostr ([:find [:toarray "jan,feb,mar,apr,may,jun,jul,ago,sep,oct,nov,dec"] [:pick $Date 0 3]]+1)]
:put ("Month=".$Month)
:if (:len $Month<2) do={
:set Month "0$Month"
}
#To be sure
:set Month [:pick [$Month] 0 2]
:put ("Month=".$Month)
# Format YYYYMMDD-HHMMSS
:global DateTimeCode ([:pick $Date 7 11]."-".$Month."-".[:pick $Date 4 6]."_-_".[:pick $Time 0 2]."-".[:pick $Time 3 5]."-".[:pick $Time 6 8])
# Format DDMMYY-HHMMSS
#:global DateTimeCode ([:pick $Date 4 6].$Month.[:pick $Date 9 11]."-".[:pick $Time 0 2].[:pick $Time 3 5].[:pick $Time 6 8])
:put ("DateTimeCode=" . $DateTimeCode)
:log info message=[:put ($DateTimeCode)]
# END Script