java 怎么对日期列进行排序
publicstaticObject[]sortDate(List<Object[]>list){}Object[13]是日期列我想取最大的一条日期信息返回,怎么弄啊...
public static Object[] sortDate(List<Object[]> list){} Object[13] 是日期列 我想取最大的一条日期信息返回,怎么弄啊
展开
2014-12-22
展开全部
通过js的可以:
var dateRE = /^(\d{2})[\/\- ](\d{2})[\/\- ](\d{4})/;
function dmyOrdA(a, b){
a = a.replace(dateRE,"$3$2$1");
b = b.replace(dateRE,"$3$2$1");
if (a>b) return 1;
if (a <b) return -1;
return 0; }
function dmyOrdD(a, b){
a = a.replace(dateRE,"$3$2$1");
b = b.replace(dateRE,"$3$2$1");
if (a>b) return -1;
if (a <b) return 1;
return 0; }
function mdyOrdA(a, b){
a = a.replace(dateRE,"$3$1$2");
b = b.replace(dateRE,"$3$1$2");
if (a>b) return 1;
if (a <b) return -1;
return 0; }
function mdyOrdD(a, b){
a = a.replace(dateRE,"$3$1$2");
b = b.replace(dateRE,"$3$1$2");
if (a>b) return -1;
if (a <b) return 1;
return 0; }
测试:
dateArray = new Array('15/10/2000','28/05/1999',
'17/09/2005','06/12/2004','02/01/1998');
dateArray.sort( dmyOrdA );
document.write('Ascending : ' + dateArray + '<br />');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询