Time format fix

Fixed setTimestamp()
This commit is contained in:
Norberto A 2020-03-03 14:22:08 +00:00 committed by GitHub
parent 23d2e60078
commit 59696c994a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -18,8 +18,15 @@ module.webhookConfig = {
local function getDate()
local date = os.date("!*t")
local str = string.format("%s-%s-%sT%s:%s:%s.000Z", date.year, date.month, date.day, date.hour, date.min, date.sec)
local function format(i)
if(string.len(i) == 1) then
return string.format("0%s", i)
else
return i
end
end
local str = string.format("%s-%s-%sT%s:%s:%s.000Z", date.year, date.month, date.day, format(date.hour), format(date.min), format(date.sec))
return str
end