在arraylist中排序日期 [英] Sort date in arraylist

查看:95
本文介绍了在arraylist中排序日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我收集的数据包含日期,设计,状态等。

我检索的数据是没有排序。

如何按日期在arraylist中对数据进行排序?

我的日期格式是M / d / yyyy



来自arraylist的样本数据:



Hi all,

I have gather a data which contain date,desc,status etc.
The data that I retrieve is not sorted.
How can I sort data by in arraylist by date?
My date format is M/d/yyyy

My sample data from arraylist:

Date      Status   Code      Description
1/1/2013  B        12010     Tunggakan
9/14/2013 R        11030     Cukai Semasa
7/1/2013  B        11010     Waran





结果应该是:





The result should be:

Date      Status   Code      Description
1/1/2013  B        12010     Tunggakan
7/1/2013  B        11010     Waran
9/14/2013 R        11030     Cukai Semasa









或者我可以放置bydate asc在我的查询中?哪一个是最好的方法?





Or can I put sort bydate asc in my query? Which one is the best approach?

推荐答案

是的,最好的方法是让你的数据库做最好的事情 - 检索,排序,分组数据......所有通常在数据库中比其他任何地方都更有效。



将sort子句抛到你的查询中它应该都很好。
Yes, the best approach is to let your database do what it's best at - retrieving, sorting, grouping data... all usually more efficient in your database than anywhere else.

Throw the sort clause onto your query and it should be all good.


这篇关于在arraylist中排序日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆