Lua UTC 변환

Jmnote (토론 | 기여)님의 2022년 5월 29일 (일) 01:27 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

개요[ | ]

Lua UTC 변환
function toUTC(str)
    local Y, m, d, H, M, S, U, z = str:match("(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+).(%d+)+(%d+)")
    local utc = os.time{year=Y, month=m, day=d, hour=H-z, min=M, sec=S}
    return os.date("%Y-%m-%dT%H:%M:%S.", t) .. U .. "Z"
end

print(toUTC('2022-05-29T00:57:18.159920951+09:00'))
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}