我必须对具有未定义长度(行)的二维数组进行排序以按日期排序。阵列必须具有此构建:
var Data = new Array();
var ArrayCount = 0;
for(var i = 0; i < CSVDataRow.length; ++i) {
CreditCardData[ArrayCount] = new Array();
Data[ArrayCount][0] = new Date(YYYY,MM,DD); // Date
Data[ArrayCount][1] = amount; // Example for Money
Data[ArrayCount][2] = purpose1; // Example for Text
Data[ArrayCount][3] = purpose2; // Example for Text
Data[ArrayCount][4] = purpose3; // Example for Text
ArrayCount = ArrayCount +1; // Count for the next Array
}
好的。这给了我一个像这样的多数组(具有未定义的长度/行):
Data[0][0] = Tue Jul 30 2013 00:00:00 GMT+0200 (MESZ)
Data[0][1] = 200.00
Data[0][2] = Example Text 02
Data[0][3] = Example Text 03
Data[0][4] = Example Text 04
Data[1][0] = Tue Jul 09 2013 00:00:00 GMT+0200 (MESZ)
Data[1][1] = 500.00
Data[1][2] = Example Text 12
Data[1][3] = Example Text 13
Data[1][4] = Example Text 14
Data[2][0] = Tue Jul 15 2013 00:00:00 GMT+0200 (MESZ)
Data[2][1] = 333.00
Data[2][2] = Example Text 22
Data[2][3] = Example Text 23
Data[2][4] = Example Text 24
Data[3][0] = Mon Jul 02 2013 00:00:00 GMT+0200 (MESZ)
Data[3][1] = 777.00
Data[3][2] = Example Text 32
Data[3][3] = Example Text 33
Data[3][4] = Example Text 34
......
......
......
......
......
现在我必须按 Unix 日期对这个多数组(具有未定义的长度/行)进行排序(好吧,这可能是像 YYYYMMDD 这样的正常日期)以降序排列。
Data[0][0] = Tue Jul 30 2013 00:00:00 GMT+0200 (MESZ)
Data[0][1] = 200.00
Data[0][2] = Example Text 02
Data[0][3] = Example Text 03
Data[0][4] = Example Text 04
Data[1][0] = Tue Jul 15 2013 00:00:00 GMT+0200 (MESZ)
Data[1][1] = 333.00
Data[1][2] = Example Text 22
Data[1][3] = Example Text 23
Data[1][4] = Example Text 24
Data[2][0] = Tue Jul 09 2013 00:00:00 GMT+0200 (MESZ)
Data[2][1] = 500.00
Data[2][2] = Example Text 12
Data[2][3] = Example Text 13
Data[2][4] = Example Text 14
Data[3][0] = Mon Jul 02 2013 00:00:00 GMT+0200 (MESZ)
Data[3][1] = 777.00
Data[3][2] = Example Text 32
Data[3][3] = Example Text 33
Data[3][4] = Example Text 34
......
......
......
......
......
互联网上没有任何帮助,我该怎么办?
非常感谢