title: Crazy MS SQL Server JDBC driver at datetime field or time zone issue?
body: <p>During debugging I end with simple example:</p>
  
  <pre><code>select convert(datetime, '2015-04-15 03:30:00') as ts
  go
  
  Apr 15 2015 03:30AM
  (1 row affected)
  
  select convert(int, datediff(second, '1970-01-01 00:00:00',
                      convert(datetime, '2015-04-15 03:30:00'))) as ts
  go
  
  1429068600
  (1 row affected)
  
  $ TZ=UTC date --date=@1429068600 +%F_%T
  2015-04-15_03:30:00
  </code></pre>
  
  <p>When I perform query from JDBC I get 2 different results not equal to above!!!! Code:</p>
  
  <pre><code>String TEST_QUERY = "select convert(datetime, '2015-04-15 03:30:00') as ts";
  PreparedStatement stmt2 = conn.prepareStatement(TEST_QUERY);
  ResultSet rs = stmt2.executeQuery();
  rs.next();
  logger.info("getTimestamp().getTime(): {}", rs.getTimestamp("ts").getTime());
  logger.info("getDate().getTime(): {}", rs.getDate("ts").getTime());
  stmt2.close();
  </code></pre>
  
  <p>Execution result (I double-check result with Coreutils <code>date</code> utility):</p>
  
  <pre><code>=&gt; getTimestamp().getTime(): 1429057800000
  
  $ TZ=UTC date --date=@1429057800 +%F_%T
  2015-04-15_00:30:00
  
  =&gt; getDate().getTime(): 1429045200000
  
  $ TZ=UTC date --date=@1429045200 +%F_%T
  2015-04-14_21:00:00
  </code></pre>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/ms378680%28v=sql.110%29.aspx" rel="nofollow">Official docs for date types and JDBC Java mapping</a> say nothing about resulted difference...</p>
  
  <p>My program executed in <code>GMT+03:00</code> timezone and I have SQL Server 2008 and try with JDBC driver 4.0 and 4.1 from <a href="https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx</a></p>
  
  <p>My expectation to get UTC timestamp (from 1970) in all cases, which is true only for Linux ODBC <code>tsql</code> utility which I use to interactively debug queries.</p>
  
  <p>WTF?</p>