[转] lua 获取本地当月天数

亲测,无误。

原文传送门:lua 获取本地当月天数

开发中有用到,记录一下。

local year,month = os.date("%Y", os.time()), os.date("%m", os.time())+1 -- 正常是获取服务器给的时间来算
local dayAmount = os.date("%d", os.time({year=year, month=month, day=0})) -- 获取当月天数

os.time() 精确到1秒

os.clock() 运行程序cpu花费的时间 精确到0.01秒

原文地址:https://www.cnblogs.com/slysky/p/5580726.html