//=================取一个月的最后一天
function getLastDay(year,nextMonth){
var theDay = new Date(year,nextMonth,0)
theDay = theDay-1
lastDay = theDay.getFullYear()+"-"+(theDay.getMonth()+1)+"-"+theDay.getDate()
Alert(lastDay);
return lastDay
}
function getLastDay(year,nextMonth){
var theDay = new Date(year,nextMonth,0)
theDay = theDay-1
lastDay = theDay.getFullYear()+"-"+(theDay.getMonth()+1)+"-"+theDay.getDate()
Alert(lastDay);
return lastDay
}
本文提供了一个JavaScript函数,用于获取指定年份和月份的最后一日的日期。通过使用Date对象和简单的日期运算,该函数能够准确地返回每月的最后一天。
3973

被折叠的 条评论
为什么被折叠?



