1

In my Spring Boot microservice I have jdbc connection configured to MSSQL database. There are about 10 different queries and among the fields there are some timestamps.

The server is located in Switzerland, all timestamps are in Swiss time.

My service need to return UTC time but all data I get from MSSQL is without timezone value, it becomes UTC time after mapping query results.

Can database connection be configured to set timezone of the server so those dates will be automatically considered in Swiss timezone?

I'd like to find smarter way than updating all queries by converting time in mapper manually.

Vitalii
  • 10,091
  • 18
  • 83
  • 151
  • Which database are you using? You may also want to look at [Is java.sql.Timestamp timezone specific?](https://stackoverflow.com/questions/14070572/is-java-sql-timestamp-timezone-specific) – Mark Rotteveel Feb 26 '18 at 17:02
  • I use Microsoft SQL Server database – Vitalii Feb 26 '18 at 22:34
  • That doesn't matter: the behavior described in my answer on that question is specified by the JDBC specification, so in general it applies to all JDBC drivers (although, unfortunately, there can be differences in interpretation...). – Mark Rotteveel Feb 27 '18 at 09:18

0 Answers0