Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sort a tableview column containing a date

936800Jun 23 2012 — edited Jun 24 2012
This is my second request to find more info on handling dates javafx2, no replies to the first so am trying again.

I am a relative "newby" to java, FX2 has so many compelling features I really want to use it.

Displaying and sorting on dates seems like such a fundamental requirement that I am surprised that I can't find any examples anywhere on handing dates in a tableview.
This would be so easy to do in Cocoa with the "date formatter" so apologies if I am missing something obvious.

If I use a formatted date the column sorts on the text not on the actual date.
eg. starting with

06/01/2012
08/01/2011
07/01/2012

sorting ascending gives

06/01/2012
07/01/2012
08/01/2011

and descending

08/01/2011
07/01/2012
06/01/2012

both wrong!

Same issue if I use a calendar in the cells.

Hope the answer is not to have a separate column for day, month and year.
This post has been answered by Narayan on Jun 23 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2012
Added on Jun 23 2012
4 comments
4,891 views