How to use RowFilter.dateFilter on JTable if it contains Strings

1.8k Views Asked by At

I want to use a RowFilter.dateFilter on a JTable, but my Table has only Strings formatted like this "yyyy-MM-dd". If it's not possible to filter my JTable through a dateFilter, how can I solve this problem?

thanks

1

There are 1 best solutions below

0
On

You should be storing Date objects in your TableModel, not a String representation of the date. Then you can use a renderer to format the date however you want it displayed. See Table Format Renderers for an example renderer.

Now you can use the DateFilter the way it was designed to be used.