Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sorting by date and time

 
Ram Sudheer Mandava
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I am getting the data as follows and i want it to be sorted in descending order by year wise, month wise , day wise and then time wise:

INPUT

2013-02-07 09:02:00.0
2013-03-28 10:54:00.0
2012-26-15 10:54:00.0
2012-26-15 09:12:00.0
2013-02-20 08:12:00.0

OUTPUT SHOULD BE AS:

2012-26-15 09:12:00.0
2012-26-15 10:54:00.0
2013-02-07 09:02:00.0
2013-02-20 08:12:00.0
2013-03-28 10:54:00.0

Anyone please tell me how to do this in java
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's your code? What have you done so far?
 
Ram Sudheer Mandava
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am just using Collections.sort(). but it is not working. Is there any other way?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show your code and explain what you mean by "not working".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic