title: How do I make java.sql.Timestamp UTC time?
body: <pre><code>public static void main(String[] args) {
  
      LocalDateTime ldt = LocalDateTime.now();
  
      ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
  
      Instant instant = Instant.from(zdt);
  
      Timestamp timestamp = Timestamp.from(instant);
  
      System.out.println(ldt + "\n");
  
      System.out.println(zdt + "\n");
  
      System.out.println(instant + "\n");
  
      System.out.println(timestamp + "\n");
  }
  </code></pre>
  
  <p>And it prints:</p>
  
  <pre><code>2017-05-07T18:13:26.969
  
  2017-05-07T18:13:26.969-04:00[America/New_York]
  
  2017-05-07T22:13:26.969Z
  
  2017-05-07 18:13:26.969
  </code></pre>
  
  <p>How can I make an SQL <code>Timestamp</code> save with the same time as the <code>Instant</code>? I need to be able to get the <code>Timestamp</code> from anywhere and convert it to whatever time it happens to be in that part of the world. The problem is that it keeps saving as the same time as whatever my system clock happens to be set at.</p>