12.12.2022, 10:36
It's a timestamp in milliseconds with timezone.
Current date/time to string conversion:
Convert string to date/time:
Current date/time to string conversion:
Code:
tz = os.date('%z')
ts, tu = os.microtime()
str = string.format('/Date(%d%03d%s)/', ts, tu / 1000, tz)
log(str)
Convert string to date/time:
Code:
str = '/Date(1670926903419+0100)/'
time = tonumber(str:match('%d+'))
ts = math.floor(time / 1000) -- timestamp in seconds
tm = time % 1000 -- millisecond part of the timestamp
date = os.date('%c', ts) -- readable date from timestamp
log(date, ts, tm)