Javascript setFullYear

Posted by user187870 on Stack Overflow See other posts from Stack Overflow or by user187870
Published on 2010-05-16T01:47:51Z Indexed on 2010/05/16 1:50 UTC
Read the original article Hit count: 162

Filed under:

var currentDate=new Date(); currentDate.setFullYear(2011); alert(currentDate); ==> this works, it sets the year to 2011 as expected.

alert((new Date()).setFullYear(2011)); ==> this one doesn't work.

Any idea why? Am I misunderstanding the syntax?

© Stack Overflow or respective owner

Related posts about JavaScript