setFullYear怎么用???
setFullYear();怎么用啊???
setFullYear();怎么用啊???
2016-03-07
setFullYear是用来设置某一个日期的年份的, 比如说你获得当前的日期之后,可以重新对它的年份进行设置, 代码如下:
var myDate = new Date();
document.write("Current date is " + myDate + "<br/>");
var myYear = myDate.getFullYear();
document.write("The getting year is: " + myYear + "<br/>");
myDate.setFullYear(2000);
document.write("The new set date is:" + myDate + "<br/>");
举报