function day_step(old_day,step) local y,m,d if("0" ~= string.sub(old_day,6,6)) then m=string.sub(old_day,6,7) else m=string.sub(old_day,7,7) end
if("0" ~= string.sub(old_day,9,9)) then d=string.sub(old_day,9,10) else d=string.sub(old_day,10,10) end
y=string.sub(old_day,0,4) local old_time=os.time{year=y,month=m,day=d} local new_time=old_time+86400*step
local new_day=os.date("*t",new_time) local res=""
if(tonumber(new_day.day)<10 and tonumber(new_day.month)<10)then res=new_day.year.."-".."0"..new_day.month.."-".."0"..new_day.day elseif tonumber(new_day.month)<10 then res=new_day.year.."-".."0"..new_day.month.."-"..new_day.day elseif tonumber(new_day.day)<10 then res=new_day.year.."-"..new_day.month.."-".."0"..new_day.day else res=new_day.year.."-"..new_day.month.."-"..new_day.day end return res end
|
请发表评论