I'm looking to import date information in a column of a JTable. The date is being read from a database as a long variable (milliseconds from 1970). I've set the date column to be of type 'Date'. My question is this: what's the best way to convert the <code>long</code> variable into a <code>Date</code> variable? I could iterate through all the rows and convert the long to Date before saving the data to the table model. Might this be an expensive operation if I have to iterate over thousands of rows? Or...could I override the <code>getValueAt</code> method in the DefaultTableModel and convert the long to a Date variable at that point? Or am I making this too difficult and there's a simple solution I've missed?
Thanks for the input, Dave
[ February 03, 2005: Message edited by: David Irwin ] [ February 03, 2005: Message edited by: David Irwin ]
I'm familiar with the long -> Date conversion but what I'm hoping to do is the following:
-set the a column's class to a 'Date' object -then save the date information (in milliseconds from epoch) in a table model -and then have the JTable display the date formatted to something like '05-02-03 11:30:00' without having to explicitly do any long -> Date conversions.
My question comes down to whether something exists in the JTable that automatically does this or do I need to explicitly do the long -> Date conversion myself.
Thanks again. [ February 03, 2005: Message edited by: David Irwin ]