Kabal said:
Not quite sure I could have worded it any clearer. As for you, if you
going just act like a 10 year don't bother replying. Believe me I
don't care to see your worthless response and neither does anyone
else.
Mr Kabal,
I think you need to back off a little. Several people were trying to help.
One point that was being made is that if you are using JDBC connection and a
ResultSet you can do a myResultSet.getDate( column# ) or getTime or
getTimeStamp. After that you have to do no more conversion, you can just
make a String. The only possible gotcha with the java.sql.TimeStamp
as the API docs tell us is...
" Due to the differences between the Timestamp class and the java.util.Date
class mentioned above, it is recommended that code not view Timestamp values
generically as an instance of java.util.Date. The inheritance relationship
between Timestamp and java.util.Date really denotes implementation inheritance,
and not type inheritance."
What's that all about? Timestamps have nanoseconds in them and ignore
the milli part of the Date class.
But I see you had a "DATETIME" and you used:
Date date = new
Date(Timestamp.valueOf(COLUMN_FROM_A_TABLE_CONTAINING_DATETIME_DATETYPE).getTime());
which uses Timestamp.valueOf
Personnally would have just asked the ResultSet to do the conversion for me by
going for the datatype I needed, so I would have gone back to the
ResultSet and instead of starting with the String from the ResultSet
done a getDate as the original reply suggested. Is there some part of
your architecture that makes that a problem?
Have I properly identified what you are trying to do?
I hope that helps, and next time try not to call repliers names BEFORE you
get the answer you are looking for. Also, as it says in a series
on Netiquette Tips,
http://email.about.com/cs/netiquettetips/qt/et123101.htm
be careful with irony.
Cheers,
-Paul