根据jquery中的当前日期创建最近12个月的数组

时间:2015-03-21 12:14:12

标签: jquery arrays date

这是当前的日期,即今天的日期

  var currentDate = new Date();

我们说今天的日期是Sat Mar 21 2015 17:19:15 GMT+0530。我使用以下代码

从日期中提取了月份
var monthNames = ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];
var month = monthNames[currentTime.getMonth()];

在我的情况下,月份= MAR

根据当前month,我想按照从month-12到当月MAR的递增顺序创建最近12个月的数组。如果当前月份为MAR

,则数组必须如此
  date = ["APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","JAN","FEB","MAR"];

如何根据当前日期获取动态数组?

提前致谢

0 个答案:

没有答案