摘要:
是否为闰年 function TimeUtil.IsLeapYear(year) local b = (year % 4 == 0 and year % 100 ~= 0) or (year % 400 == 0) return b end local m_MonthDaysMap = { 31, 阅读全文
摘要:
美国习惯星期转中国习惯星期function TimeUtil.WdayToWdayCN(wday) if 1 == wday then return 7 else return wday - 1 end end 美国习惯的星期加减, 1_周日, 2_周一 ... 7_周六 function Time 阅读全文
摘要:
一些工具函数 获取本地时区偏差 @return integer 当前时区与UTC时间的偏移秒数 function TimeUtil.GetLocalTimeZoneOffset() local timestamp = os.time() local date = os.date("!*t", tim 阅读全文
摘要:
isdst参数对os.time的影响 把电脑时区先改为UTC-5时区,这边用美国东部时区(UTC-5)来试验 local function PrintDate(tag, deltaTimestamp, dt) if dt.isdst then print(tag, deltaTimestamp, s 阅读全文
摘要:
lua中的数组索引从1开始 --x最小值为1 local function CircularAccess(x) local arr = ["a", "b", "c"] local idx = math.fmod(x, #arr) if 0 == idx then idx = #arr end pri 阅读全文
摘要:
TimeCompare = TimeCompare or {} local TimeCompareT = TimeCompare function TimeCompareT.ParseTimeStr(timeStr) local pattern = "^(%d+)-(%d+)-(%d+) (%d+) 阅读全文