This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

ISO 8601
#1
Is there any way to convert date\time to ISO 8601 format? I need this for a timestamp sting communicating with an api.
Reply
#2
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)
Reply
#3
worked lika a charm, thank you Erwin.
Reply


Forum Jump: