asp怎么获取当月最后一日???

来源:百度知道 编辑:UC知道 时间:2024/07/16 13:25:57
怎么才能获取每月的最后一日???

菜鸟求教了~~~!!!

谢谢

用IF语句判断呀.
月份不外乎三种:一是月小的30天,另一个是月大的31天,全年有区别的只是二月份,而能被4整除的是闰年的2月,29天,其它的都是28天,这样就可以编写这样的程序:

ho=month(date())
if ho=1 or ho=3 or ho=5 or ho=7 or ho=9 or ho=11 then
days=31'31天
else
if ho=4 or or ho=6 or ho=8 or ho=10 or ho=12 then
days=30'30天
else
if ho=2 and instr((year(date())/4),".")<1 then
ho=29
else
if ho=2 and instr((year(date())/4),".")>0 then
ho=28
end if
end if
end if
end if

下个月1号的前一天
即 当月一号加一个月再减一天

DateAdd (day,-1, DateAdd (m,1,date())