Hi all,
I have a column in a SQL Server database of type DATESTAMP and I want to put the exact time of a certain action in there when a record is added. But the timestamp seems to be causing me trouble when I try to insert it.
So far I have this (params array just holds the insert values, the SQL strings are constructed using MessageFormat objects) :
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyy HH:mm:ss:SSS");
Date date = new Date(new java.util.Date().getTime());
params[11] = sdf.format(date);
But it doesn't work due to it beign an "invalid timestamp value". I've also tried:
Date date = new Date(new java.util.Date().getTime());
Timestamp tStamp = new Timestamp(date.getTime());
params[11] = tStamp;
But no joy. Note that "date" is of the Java.sql variety. Can anyone tell me the Java equivalent of the SQL TIMESTAMP datatype?
Cheers,
Illu