Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

lua string to date

s="Sat, 29 Oct 1994 19:43:31 GMT"
p="%a+, (%d+) (%a+) (%d+) (%d+):(%d+):(%d+) GMT"
day,month,year,hour,min,sec=s:match(p)
MON={Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12}
month=MON[month]
offset=os.time()-os.time(os.date("!*t"))
print(os.time({day=day,month=month,year=year,hour=hour,min=min,sec=sec})+offset)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #lua #string #date
ADD COMMENT
Topic
Name
4+9 =