Bug #2876 | Zeroed time using setDate() | ||
---|---|---|---|
Submitted: | 18 Feb 2004 13:30 | Modified: | 18 Feb 2004 13:51 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 3.0 | OS: | |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[18 Feb 2004 13:30]
[ name withheld ]
[18 Feb 2004 13:32]
[ name withheld ]
[Sorry - clicked submit too soon] The last row in the above example table is the result of using setTimestamp()
[18 Feb 2004 13:51]
Mark Matthews
The JDBC spec states that java.sql.Dates have _no_ time component, and must have the hour/minute set to midnight and 0 minutes: (from http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html): "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."
[19 Feb 2004 7:42]
[ name withheld ]
Ah, didn't know that. Sorry and thanks.