如何将日期解析到数组中?

时间:2012-06-10 14:27:12

标签: javascript

  

11.06.2012 17:40

我需要的所有东西都要放入数组值

mydate.day = 11;
mydate.month = 6;
mydate.year = 2012;
mydate.hours = 17;
mydate.minutes = 40;

1 个答案:

答案 0 :(得分:16)

"11.06.2012 17:40".split(/[.: ]/).map(Number);
//[11, 6, 2012, 17, 40]