I may make mistakes, but before you write, you better double check what I wrote and what you did...
(note: I'm on GMT+02:00)
(note: I'm on GMT+02:00)
terminal example code
[rex@test-v7.16.2] > :global unixtodatetime do={{... :local ux [:tonum $1]{... :local Fzerofill do={:return [:pick (100 + $1) 1 3]}{... :local prMntDays [:toarray "0,0,31,59,90,120,151,181,212,243,273,304,334"]{... :local vgmt [:tonum [/system clock get gmt-offset]]; :if ($vgmt > 0x7FFFFFFF) do={:set vgmt ($vgmt - 0x100000000)}{... :if ($vgmt < 0) do={:set vgmt ($vgmt * -1)}{... :local tzepoch ($ux + $vgmt){... :if ($tzepoch < 0) do={:set tzepoch 0} ; # unsupported negative unix epoch{... :local yearStart (1970 + ($tzepoch / 31536000)){... :local tmpbissex (($yearStart - 1968) / 4) ; :if ((($yearStart - 1968) % 4) = 0) do={:set ($prMntDays->1) -1 ; :set ($prMntDays->2) 30}{... :local tmpsec ($tzepoch % 31536000){... :local tmpdays (($tmpsec / 86400) - $tmpbissex){... :if (($tmpsec < (86400 * $tmpbissex)) and ((($yearStart - 1968) % 4) = 0)) do={{{... :set tmpbissex ($tmpbissex - 1) ; :set ($prMntDays->1) 0 ; :set ($prMntDays->2) 31 ; :set tmpdays ($tmpdays + 1){{... }{... :if ($tmpsec < (86400 * $tmpbissex)) do={:set yearStart ($yearStart - 1) ; :set tmpdays ($tmpdays + 365)}{... :local mnthStart 12 ; :while (($prMntDays->$mnthStart) > $tmpdays) do={:set mnthStart ($mnthStart - 1)}{... :local dayStart [$Fzerofill (($tmpdays + 1) - ($prMntDays->$mnthStart))]{... :local timeStart (00:00:00 + [:totime ($tmpsec % 86400)]){... :return ("$yearStart-$[$Fzerofill $mnthStart]-$[$Fzerofill $dayStart]","$timeStart"){... }[rex@test-v7.16.2] > :local nstart [$unixtodatetime ([:timestamp] + 30m)] ; :put "Start date: $($nstart->0) and start time: $($nstart->1)"Start date: 2025-04-06 and start time: 22:09:37[rex@test-v7.16.2] >
Statistics: Posted by rextended — Mon Apr 07, 2025 12:41 am