Advertisement
skypop

dateConv

Nov 1st, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local monthNum = {["Jan"]="01",["Feb"]="02",["Mar"]="03",["Apr"]="04",["May"]="05",["Jun"]="06",["Jul"]="07",["Aug"]="08",["Sep"]="09",["Oct"]="10",["Nov"]="11",["Dec"]="12"}
  2. function dateConv(str)
  3.   local month,day,h,m,s,year = string.match(str, "%a+ (%a+) (%d+) (%d+):(%d+):(%d+) CEST (%d+)")
  4.   return string.format("%s-%s-%s",tostring(year),monthNum[month],tostring(day)),tostring(h),string.format("%s:%s:%s",tostring(h),tostring(m),tostring(s))
  5. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement