Calculate date and time in script

1ft + 1m do not do 2_something_,

You must first convert ft to m, or m to ft, or both to another omogeneous format.

Since “mar/04/2024 16:37:18” is a stupid string, only an idiot of a programmer (I’m referring to the past) could choose such
a silly method of representing the date, instead of using a better sortable and more matematically logic form, like: 2024-03-04 16:37:18.
(same consideration for the Italian “& Co.” 04/03/2024),

Since a string is a string, you must first convert date-time to unix time and interval to seconds, then this is possible:
current_unix_time + time_interval_seconds = next_unix_time

Converting next_unix_time back to one date, you have the wanted value.


For example this print current timestamp value ahead of 1 hour on v7.13.5

:put ([:timestamp] + 1h)

the same, but for out the unix epoch, but this time 3 days

:put [:tonum ([:timestamp] + 3d)]

The function datetime2epoch is explained here
http://forum.mikrotik.com/t/i-did-it-script-to-compute-unix-time/68576/24

And unixtodatetime here
http://forum.mikrotik.com/t/convert-uptime-to-date-and-time/157724/36