Skip to content

fix: Fix UTC<->Timezone conversion issue for DST start and end timestamp#2260

Merged
sakthivelmanii merged 1 commit intomainfrom
fix_dst_start_issue
Feb 27, 2026
Merged

fix: Fix UTC<->Timezone conversion issue for DST start and end timestamp#2260
sakthivelmanii merged 1 commit intomainfrom
fix_dst_start_issue

Conversation

@sakthivelmanii
Copy link
Contributor

UTC conversion issue:

Example date: 2018-03-25 01:00:00 UTC(or 2018-03-25 03:00:00+02:00)

Conversion to UTC

Original Epoch: 1 AM UTC (1521939600000) or 3 AM (Paris Time)
Calculated Offset: 2 hours ( 1 hr Raw Offset + 1 hr DST)
Offset Epoch: 11 PM UTC (1521932400000)

UTC to actual time

Original Epoch: 11 PM UTC (1521932400000 )
Calculated Offset: 1 hr ( 1hr Raw offset)
Timezone converted Epoch: 12 AM UTC(1521936000000)

We are losing 1hr because of DST. In order to solve this issue, we are adding timezone raw offset and DST savings so that it will handle the edge case when timestamp is start of DST.

Offset is purely computed on two fields. Raw offset and if time is within DST, then DST offset.

@sakthivelmanii sakthivelmanii requested a review from a team October 21, 2025 13:57
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner-jdbc API. labels Oct 21, 2025
@sakthivelmanii sakthivelmanii marked this pull request as draft October 21, 2025 14:27
rahul2393
rahul2393 previously approved these changes Oct 21, 2025
@sakthivelmanii sakthivelmanii marked this pull request as ready for review October 21, 2025 14:55
olavloite
olavloite previously approved these changes Oct 22, 2025
assertThat(actual).isEqualTo(expected.withZoneSameInstant(timeZone.toZoneId()));
});

TimeZone.setDefault(TimeZone.getDefault());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does this do anything? It seems to set the default to the current default

@sakthivelmanii sakthivelmanii changed the title fix: Fix DST issue on UTC conversion fix: Fix UTC<->Timezone conversion issue for DST start and end timestamp Oct 22, 2025
@sakthivelmanii sakthivelmanii added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 28, 2025
@sakthivelmanii sakthivelmanii removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 17, 2025
@sakthivelmanii sakthivelmanii requested a review from a team as a code owner February 26, 2026 17:53
@sakthivelmanii sakthivelmanii merged commit 14837f8 into main Feb 27, 2026
28 checks passed
@sakthivelmanii sakthivelmanii deleted the fix_dst_start_issue branch February 27, 2026 10:21
gcf-merge-on-green bot pushed a commit that referenced this pull request Mar 4, 2026
🤖 I have created a release *beep* *boop*
---


## [2.35.4](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.35.3...v2.35.4) (2026-03-04)


### Bug Fixes

* Fix Column Type Name for PostgreSQL ARRAY types ([#2409](https://togithub.com/googleapis/java-spanner-jdbc/issues/2409)) ([c171388](https://togithub.com/googleapis/java-spanner-jdbc/commit/c1713882f7d945b60aa9e305234535e0b5a37e6c))
* Fix UTC&lt;-&gt;Timezone conversion issue for DST start and end timestamp ([#2260](https://togithub.com/googleapis/java-spanner-jdbc/issues/2260)) ([14837f8](https://togithub.com/googleapis/java-spanner-jdbc/commit/14837f8d195a338089eca1b2bfe316f030012967))


### Dependencies

* Update dependency com.fasterxml.jackson.core:jackson-databind to v2.21.1 ([#2406](https://togithub.com/googleapis/java-spanner-jdbc/issues/2406)) ([96f106e](https://togithub.com/googleapis/java-spanner-jdbc/commit/96f106e551d3c47a557fac2ec95aadb4d9cc1990))
* Update dependency com.google.api.grpc:proto-google-cloud-trace-v1 to v2.85.0 ([#2395](https://togithub.com/googleapis/java-spanner-jdbc/issues/2395)) ([8a214f8](https://togithub.com/googleapis/java-spanner-jdbc/commit/8a214f8b3ddb2c823dacc82ad1559cdf0db67004))
* Update dependency com.google.api.grpc:proto-google-cloud-trace-v1 to v2.86.0 ([#2407](https://togithub.com/googleapis/java-spanner-jdbc/issues/2407)) ([b542d69](https://togithub.com/googleapis/java-spanner-jdbc/commit/b542d696e171b894483b8a4bff5d0c7befaddd96))
* Update dependency com.google.cloud:google-cloud-spanner to v6.111.1 ([#2410](https://togithub.com/googleapis/java-spanner-jdbc/issues/2410)) ([39dd81b](https://togithub.com/googleapis/java-spanner-jdbc/commit/39dd81b9b456bea03a1018125c3f5db7e4ff047a))
* Update dependency com.google.cloud:google-cloud-spanner-bom to v6.111.1 ([#2411](https://togithub.com/googleapis/java-spanner-jdbc/issues/2411)) ([5e636ed](https://togithub.com/googleapis/java-spanner-jdbc/commit/5e636edb5712b90815c14f72d0d6e8d559642550))
* Update dependency com.google.cloud:google-cloud-trace to v2.85.0 ([#2396](https://togithub.com/googleapis/java-spanner-jdbc/issues/2396)) ([122545c](https://togithub.com/googleapis/java-spanner-jdbc/commit/122545c3b0b3c660defd9aeae37a9442a16ebd8f))
* Update dependency com.google.cloud:google-cloud-trace to v2.86.0 ([#2408](https://togithub.com/googleapis/java-spanner-jdbc/issues/2408)) ([6af6e48](https://togithub.com/googleapis/java-spanner-jdbc/commit/6af6e48cad6c6229058d68b599d96f4cdd64df40))
* Update dependency com.google.cloud:sdk-platform-java-config to v3.57.0 ([#2405](https://togithub.com/googleapis/java-spanner-jdbc/issues/2405)) ([8e54669](https://togithub.com/googleapis/java-spanner-jdbc/commit/8e54669eae29522a15da84f4aec819ca3305a25c))
* Update dependency net.bytebuddy:byte-buddy to v1.18.5 ([#2397](https://togithub.com/googleapis/java-spanner-jdbc/issues/2397)) ([6736c63](https://togithub.com/googleapis/java-spanner-jdbc/commit/6736c63fda79bfc1c2071b4de64e2e6bdd70594e))
* Update dependency net.bytebuddy:byte-buddy-agent to v1.18.5 ([#2398](https://togithub.com/googleapis/java-spanner-jdbc/issues/2398)) ([deaef26](https://togithub.com/googleapis/java-spanner-jdbc/commit/deaef26f58d865a995dc99562fa058091455bcb4))
* Update dependency org.springframework.boot:spring-boot to v4.0.3 ([#2403](https://togithub.com/googleapis/java-spanner-jdbc/issues/2403)) ([37aed98](https://togithub.com/googleapis/java-spanner-jdbc/commit/37aed98531e986827d8e5169ae434493d81059c2))
* Update dependency org.springframework.boot:spring-boot-starter-data-jdbc to v4.0.3 ([#2404](https://togithub.com/googleapis/java-spanner-jdbc/issues/2404)) ([385e930](https://togithub.com/googleapis/java-spanner-jdbc/commit/385e930f1d102fb3a35d300f8c838fdaf6a6617c))
* Update dependency org.springframework.boot:spring-boot-starter-parent to v3.5.11 ([#2402](https://togithub.com/googleapis/java-spanner-jdbc/issues/2402)) ([f451bca](https://togithub.com/googleapis/java-spanner-jdbc/commit/f451bca0f6aa24a3ea0e47361797186eafac34b1))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner-jdbc API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants