Is there any way to convert date\time to ISO 8601 format? I need this for a timestamp sting communicating with an api.
|
ISO 8601
|
|
12.11.2023, 13:08
(This post was last modified: 13.11.2023, 06:27 by Erwin van der Zwart.)
Try this:
Code: function iso_8601_timestamp()
local now, nowms = os.microtime()
local ms = math.round(nowms / 1000, 0)
return os.date("!%Y-%m-%dT%T", now) .. "." .. ms .. "Z"
end
stamp = iso_8601_timestamp()
log(stamp)
12.11.2023, 17:16
worked lika a charm, thank you Erwin.
|
|
« Next Oldest | Next Newest »
|