![java.util.sql setdate java.util.sql setdate](https://media.geeksforgeeks.org/wp-content/uploads/20210324192053/javawayoftime.png)
![java.util.sql setdate java.util.sql setdate](https://i1.wp.com/www.waytoeasylearn.com/wp-content/uploads/2020/01/Capture-26.png)
Hopefully this will save someone a headache.
![java.util.sql setdate java.util.sql setdate](https://i.stack.imgur.com/MDe2Z.png)
This is probably the intended behavior for JasperReports, but I thought it would be nice to warn people away from using. So, the getTime () API method of is used here that returns the number of milliseconds since January 1, 1970, 00:00:00 GMT. This constructor needs a long param, which is the time value in milliseconds. To conform with the definition of SQL DATE, the millisecond values wrapped by a 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. In this method, the object is converted to a object, using the (long date) constructor. instead use the constructor Date (long date) Constructs a Date object initialized with the given year, month, and day. Sets the designated parameter to the given date and calendar values. From the API documentation: To conform with the definition of SQL DATE, the millisecond values wrapped by a 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. Object finalize, getClass, notify, notifyAll, wait, wait, wait Constructor Details Date Deprecated ( since '1.2') public Date (int year, int month, int day) Deprecated. PreparedStatement has setters for all three values, setDate() being the one for sql.Date, setTime(). It is converting to which drops the time part of the per the API The Java type will be normalized to represent only a SQL DATE and not an instant of Time. Depends on the SQL type of the field, really. tDate( i + 1, new ( (()parameterValue).getTime() ) ) } The setTime () method of the class accepts a variable of long type, representing the number of milliseconds from the epoch time (Janu00:00:00.000 GMT) to the required time, and sets the specified time value to the current Date object.