title: Convert java.time.LocalDateTime SE 8 to timestamp
body: <p>How do you convert a Localdatetime to timestamp? I want to use the new SE 8 date api because it is better than the util date and calendar. I plan to use localdatetime throughout my program and then place that date into a mysql database. I have looked for an answer but there doesn't seem to be very many questions and answers for java.time. This is a little of the code that I am testing. This is as far as I got. </p>
  
  <pre><code>        LocalDateTime c = LocalDateTime.now();
  
          java.sql.Timestamp javaSqlDate = new java.sql.Timestamp(c.getLong());
  </code></pre>
  
  <p>I think I need to convert it into a long first, but I don't know how. The api allows for converting individual elements like month and day, but not for the whole date. Since I'm already here, how do you convert back from timestamp? Should I just use jodatime?</p>
  
  <p>I tried this:  </p>
  
  <pre><code> LocalDateTime c = LocalDateTime.now();
   ZoneId zoneId = ZoneId.systemDefault();
  
   System.out.println("this:" + c);
  
   java.sql.Timestamp javaSqlDate = new java.sql.Timestamp(c.atZone(zoneId).toEpochSecond());
  
   pst.setTimestamp(2, javaSqlDate);
  </code></pre>
  
  <p>This only saves the date around 1970. The system.print prints the current date correctly. I want it to save the current date.</p>