设置当前年份的使用详解()方法在Javascript

Javascript date.setfullyear()方法指定在当地时间今年的日期。

语法


date.setfullyear(yearvalue {,monthvalue {,dayvalue } })




注意:括号中的参数是可选的。

下面是参数的详细信息:

yearvalue:一个整数,指定年、数字值,例如,2008
monthvalue:月从一月到十二月从0到11的整数
dayvalue:1和31之间的整数,表示一天的一个月。如果dayvalue参数指定的monthvalue也必须指定


如果monthvalue和dayvalue参数未指定,返回的值以获得当前的月份和getdate方法

返回值:

Na


实例uff1a




Javascript设置当前年份的方法



VaR DT =新的日期(2008年8月28日23:30:00 );
(2000)dt.setfullyear;
document.write(DT);







这将产生以下结果:


8月28日星期23:30:00 UTC + 0530 2000