摘要:
美国习惯星期转中国习惯星期function TimeUtil.WdayToWdayCN(wday) if 1 == wday then return 7 else return wday - 1 end end 美国习惯的星期加减, 1_周日, 2_周一 ... 7_周六 function Time 阅读全文
posted @ 2025-08-30 19:06
yanghui01
阅读(12)
评论(0)
推荐(0)
摘要:
一些工具函数 获取本地时区偏差 @return integer 当前时区与UTC时间的偏移秒数 function TimeUtil.GetLocalTimeZoneOffset() local timestamp = os.time() local date = os.date("!*t", tim 阅读全文
posted @ 2025-08-30 15:32
yanghui01
阅读(17)
评论(0)
推荐(0)
摘要:
测试代码 local date1 = { year = 2024, month = 11, day = 3, hour = 1, min = 0, sec = 0 } local timestamp1 = os.time(date1) local date2 = { year = 2024, mon 阅读全文
posted @ 2025-08-30 15:31
yanghui01
阅读(13)
评论(0)
推荐(0)
摘要:
对于美国东部时区(UTC-5) ,如果只有日期时间信息,2024-03-10 02:00:00,我们没法直接判断是否为夏令时,为什么呢?看下面两个时间字符串: 1) 2024-03-10 02:00:00(EST, UTC-5) 是夏令时 2) 2024-03-10 02:00:00(EDT, UT 阅读全文
posted @ 2025-08-30 15:31
yanghui01
阅读(13)
评论(0)
推荐(0)
摘要:
isdst参数对os.time的影响 把电脑时区先改为UTC-5时区,这边用美国东部时区(UTC-5)来试验 local function PrintDate(tag, deltaTimestamp, dt) if dt.isdst then print(tag, deltaTimestamp, s 阅读全文
posted @ 2025-08-30 15:31
yanghui01
阅读(59)
评论(0)
推荐(0)
摘要:
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 阅读全文
posted @ 2025-08-30 15:30
yanghui01
阅读(5)
评论(0)
推荐(0)

浙公网安备 33010602011771号