title: How to store Timestamp in MS SQL Server with JPA?
body: <p>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 <code>datetime</code>/<code>datetime2</code> returns data in local timezone only and not UTC.</p>
  
  <p>I considered using <code>datetimeoffset</code> SQL Server data type, but instead of the standart <code>java.sql.Timestamp</code> it returns a proprietary object, incompatible with other databases I am working with.</p>
  
  <p>The only semi-working solution that I found is to force JVM timezone to be UTC (e.g. <code>TimeZone.setDefault(TimeZone.getTimeZone("UTC"))</code>). It causes MS SQL Server driver to return time in UTC for the <code>datetime</code>/<code>datetime2</code> data type.</p>
  
  <p>Is there a better a solution?</p>