Lua脚本 题目:输入某年某月某日,判断这一天是这一年的第几天? 怎么写
1个回答
展开全部
function getDays(year,month,day)
local leapYear={31,29,31,30,31,30,31,31,30,31,30,31}
local commonYear={31,28,31,30,31,30,31,31,30,31,30,31}
local templateYear
local count
if year %4 ==0 then
templateYear=leapYear
else
templateYear=commonYear
end
for i=1,month-1 do
count =count +templateYear[i]
end
count =count+day
return count
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询