<!--javascript取当月最后一天-->
<script language=javascript>
var current = new Date();
var year = current.getYear();
var month = current.getMonth();
showMonthLastDay(year, month);
function showMonthLastDay(year,month)
{
alert("year:"+year+", month:"+month);
year = ( year < 1900 ) ? ( 1900 +year ) : year;
var tempDate = new Date();
tempDate.setYear(year);
tempDate.setMonth(month+1);
tempDate.setDate(0);
var tempYear = tempDate.getYear();
tempYear = ( tempYear < 1900 ) ? ( 1900 +tempYear ) : tempYear;
alert("本月最后一天:"+tempYear+"-"+(tempDate.getMonth()+1)+"-"+tempDate.getDate());
}
</script>
javascript取当月最后一天
最新推荐文章于 2023-08-01 16:53:21 发布