I have an application that works with JPA and stores date and time using UTC.
I am adding support for MS SQL Server and not sure how to store time. The standard
datetime2 returns data in local timezone only and not UTC.
The only semi-working solution that I found is to force JVM timezone to be UTC (e.g.
TimeZone.setDefault(TimeZone.getTimeZone("UTC"))). It causes MS SQL Server driver to return time in UTC for the
datetime2 data type.
java sql-server datetime jpa sql-server-2012