timestamp with java
Posted on 2003-03-31
I am using Interbase 6 and 7.I can reproduce the problem in both versions of IB
I have columns of data type TIMESTAMP.
I have a java program for inserting records, it seems that the data that gets entered into these TIMESTAMP columns are only capturing the date.
here is the code below to convert java.util.Date to java.sql.Date to be used with a prepared statement.
i need it to capture the date and time.
private java.sql.Date convert(java.util.Date d)
java.sql.Date res = new java.sql.Date(new java.util.Date().getTime());
if (d != null)
res = new java.sql.Date(d.getTime());
d that gets passed in is new java.util.Date(), i can see the long values when i am in the debugger
is there a setting that i need to set on the Interbase database?
setting the prepared statment as follows
ps.setDate(some pos, convert(new java.util.Date()));