Hi
I am sending a date and time to a Jax WS. Then the WS is connecting to a SQL database and inserting this data into a table. When I send the date and time in, it has the correct date and time. Then I perform the following before sending it to the database:
The secureUserTrans object is storing the date in java.util.Date format. When this date makes it to the database, it is getting stored in a truncated format without the time. No truncation is being done on the
java or SQL side explicitly.
I did notice this when reading about java.sql.Date:
A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT.
To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated.
Could that be where this is occurring? I thought using .getTime() would deal with this.
I am not yet in a position to step through this code and see exactly where the date is being changed. I will be doing that sometime today I hope. But I thought I might ask here if I am right about that quote. But even if that were the case I would still expect the date and time in the database, only that the time would be all zeros. But maybe that is how it gets displayed/stored if the time is set to 0?
edit -
oh the main reason I opened this
thread is to ask how I can deal with java.sql.Date setting my time to zero if that is in fact what is happening. Is there any way to deal with this since I need to have the correct time when I insert this into the database, short of sending a separate time parameter (and adding a column for time to my table ...)