<script>
var theDate=new Date("2004/1/07");
var theDayNumOfThisMonth=(new Date(theDate.getFullYear(),theDate.getMonth()+1,0)).getDate();
alert(theDayNumOfThisMonth);</script>
var theDate=new Date("2004/1/07");
var theDayNumOfThisMonth=(new Date(theDate.getFullYear(),theDate.getMonth()+1,0)).getDate();
alert(theDayNumOfThisMonth);</script>
没有直接的。
用我这个函数最简短了。Function GetMonthDays(y,m) '''参数:年,月
dim s
s = CDate(y &"-"& m & "-1")
GetMonthDays = DateDiff("d",s,DateAdd("m",1,s))
End Function
或者:
Function GetMonthDays(varDate) '''参数:日期
dim s
s = CDate(Year(varDate) &"-"& Month(varDate) & "-1")
GetMonthDays = DateDiff("d",s,DateAdd("m",1,s))
End Function