This is because April has only 30 days. 31 of april does not exit. So you should set setDate(1) before doing setMonth(3)
Maurice -----Message d'origine----- De : after24 [mailto:vinc...@after24.net] Envoyé : lundi 31 mars 2014 18:47 À : dev@flex.apache.org Objet : Strange behavior with setMonth method of Date object Hello, I'm facing a strange behavior with the Date object : var myDate:Date = new Date(); myDate.setFullYear(2014); myDate.setMonth(3); trace(myDate); // return Thu May 1 18:31:07 GMT+0200 2014 myDate.setMonth(3); trace(myDate); // return Tue Apr 1 18:31:07 GMT+0200 2014 The returned month is false the first time. This behavior seems to occur only today(Mar 31, 2014), if I change my system date, the two trace statements returns the same date. Is it a flash player bug (the only thing I found on the Adobe bugbase is https://bugbase.adobe.com/index.cfm?event=bug&id=2927909 <https://bugbase.adobe.com/index.cfm?event=bug&id=2927909> ) or am I missing something ? -- View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Strange-behavior-with-setMonth-method-of-Date-object-tp36525.html Sent from the Apache Flex Development mailing list archive at Nabble.com.