question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timezone handling

See original GitHub issue

For an Instant defined as:

LocalDate.of(2021, 1, 1).atStartOfDay(ZoneOffset.UTC).toInstant()

when using Spring Data JDBC repository save method I’d expect the end result in MSSQL database column of type datetime2 to be of value: 2021-01-01 00:00:00.0000000 but it contains value 2021-01-01 01:00:00.0000000 suggesting that Spring Data JDBC uses my machine timezone when converting Instant.

Is this behavior documented anywhere and can it be configured somehow? I’d like my application to always use UTC unless a type with explicit timezone and/or offset is used.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Demo-80commented, Nov 16, 2021

@Demo-80请不要只劫持相关的票证。另外,您的问题似乎是一个用法问题。请在 Stackoverflow 上询问那些人。

如果您认为自己发现了错误或想要分享功能或改进的想法,请随时创建票证。 I’m sorry

1reaction
schaudercommented, Jun 28, 2021

We’ll probably implement some way to configure this. In the meantime you should be able to register custom converters for the conversion from and to Timestamp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 simple rules for effectively handling dates and timezones
Rule #1 - STORE DATETIMES IN UTC IN YOUR DATABASE, AND BACK END CODE. It is important that there is consistency across all...
Read more >
How to Handle Timezones and Synchronize Your Software ...
When you develop some software you may not think about timezones at first. Unless you live in a country which has to deal...
Read more >
Handling timezone in Python - GeeksforGeeks
astimezone() method is used to manipulate i.e., to convert the datetime objects to the new specified datetime object. It uses an instance of...
Read more >
The best way to handle time zones in a Java web application
To simplify the time zone handling process, it's best practice to store timestamps in UTC (Coordinated Universal Time) and convert the ...
Read more >
Working with Time Zones - W3C
6.5 Working with Date and Time Values that Require a Time Zone (and not a ... Correct handling of past time values requires...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found