---判断是否时同一天 ---@param stampA number ---@param stampB number ---@param resetInfo table|nil {[hour]=5, [min]=0, [seconds]=0, } @重置时间 ---@return boolean function ModelTime.isSameDay(stampA, stampB, resetInfo) assert(stampA ~= nil, "error:stampA=nil") assert(stampB ~= nil, "error:stampB=nil") if stampA > stampB then stampA, stampB = stampB, stampA end if resetInfo then local resetSeconds = (resetInfo.hour or 0) * 3600 + (resetInfo.minute or 0) * 60 + (resetInfo.seconds or 0) stampA = stampA - resetSeconds stampB = stampB - resetSeconds end local dateA = os.date("*t", stampA) local dateB = os.date("*t", stampB) return dateA.day == dateB.day and dateA.month == dateB.month and dateA.year == dateB.year end
判断是否时同一天
最新推荐文章于 2022-02-24 11:20:38 发布