as3 - 添加一个月

as3 - Adding one month

我目前正在使用 actionscript 3,发现它总是比实际显示时间少一个月(目前它显示“21.11.2015”,但应该显示“21.12.2015”)。这就是为什么我想知道将“1”添加到我的 "my_date.month" 的命令。我没有 post 带有日期和年份的代码,只有月份。提前致谢。

function onTimer(e:TimerEvent):void {
my_date = new Date();
tag.text = "" +my_date.month);  
}

日期 class returns 0 到 11 的 month 属性。这与从零开始的数组对齐,这意味着 数组中的第一个 元素的索引为零 (0)。

Date Class:

month : Number The month (0 for January, 1 for February, and so on) portion of a Date object according to local time.

感谢大家的回答和帮助。我可以通过强制从 01 到 12 的数组来实现它。 -> 显示这个数组解决了我的问题:)