javascript date.setutcfullyear()方法按照通用时间将全年为指定的日期。
语法
date.setutcfullyear(yearvalue[, monthvalue[, dayvalue]])
注:括号内外的数据是可选的
下面是参数的详细信息:
- yearvalue : 一个整数,指定年份的数字值,例如,2008年。
- monthvalue : 从0到11的整数表示的月份,从一月到十二月。
- dayvalue : 1到31之间的整数,表示该月的一天。如果指定dayvalue参数,则还必须指定monthvalue。
如果不指定monthvalue和dayvalue参数,从getmonth和getdate方法返回的值被使用。如果指定的参数是预期范围之外,调用setutcfullyear尝试更新的其他参数和date对象相应的日期信息。例如,如果为monthvalue指定15,年由1(年+ 1)的增量,3用于表示月份。
返回值:
- na
例子:
<html> <head> <title>javascript setutcfullyear method</title> </head> <body> <script type="text/javascript"> var dt = new date( "aug 28, 2008 23:30:00" ); dt.setutcfullyear( 2006 ); document.write( dt ); </script> </body> </html>
这将产生以下结果:
mon aug 28 23:30:00 utc+0530 2006
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论