Timezone handling
See original GitHub issueFor 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:
- Created 2 years ago
- Comments:12 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
.