12.12.2022, 10:23
Hello, could anybody tell me how to format LM time to this format and vise versa?
Code:
1
/Date(1670926903419+0100)/
Time Format
|
12.12.2022, 10:23
Hello, could anybody tell me how to format LM time to this format and vise versa?
Code: 1 /Date(1670926903419+0100)/
12.12.2022, 10:36
It's a timestamp in milliseconds with timezone.
Current date/time to string conversion: Code: 12345 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: 12345678910 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)(12.12.2022, 10:36)admin Wrote: It's a timestamp in milliseconds with timezone. Thanks! And if I wanted to at for example 24h to the "str" string, to use as a from-to range?
12.12.2022, 10:59
You can add 86400 to ts variable.
|
« Next Oldest | Next Newest »
|