Skip to content

ResultSet.getTimestamp() returns incorrect point in time for historical dates #2789

@m-van-tilburg

Description

@m-van-tilburg

Driver version

12.10.1.jre11.

SQL Server version

Microsoft SQL Server 2022 (RTM-CU20-GDR) (KB5065220) - 16.0.4212.1 (X64).

Client Operating System

Windows 10 Pro.

JAVA/JVM version

21.0.2.

Table schema

CREATE TABLE [timestamp_test] (
[my_id] [BIGINT] NOT NULL,
[my_timestamp] [datetime2],
CONSTRAINT pk_timestamp_test PRIMARY KEY CLUSTERED ( [my_id] )
);

Problem description

ResultSet.getTimestamp() returns incorrect point in time for historical dates.

Expected behavior

A Timestamp that matches the datetime2 column value in the database.

Actual behavior

A Timestamp that appears to be incorrectly created using the Julian calendar instead of the (proleptic) Gregorian calendar.

Any other details that can be helpful

See attached reproduction source code:

MssqlJdbcTest.java

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions