title: Converting a time to milliseconds correctly in java.time (Java 8)
body: <p>I've been trying to convert a "DateTime" to milliseconds using the java.time package built into Java 8. </p>
  
  <p>But I haven't been able to do it correctly. I am trying to convert "29/Jan/2015:18:00:00" to milliseconds. The following is something I tried</p>
  
  <pre><code>Instant instant = Instant.parse("2015-01-29T18:00:00.0z");
  Long instantMilliSeconds = Long.parseLong(instant.getEpochSecond() + "" + instant.get(ChronoField.MILLI_OF_SECOND));
  System.out.println(new Date(instantMilliSeconds)); // prints Sun Jun 14 05:06:00 PDT 1970
  </code></pre>
  
  <p>I tried using <code>LocalDateTime</code>, but couldn't find a way to effectively do the conversion to milliseconds. I am not saying this is the best way to do this, if you know something better, I would really appreciate some pointers. </p>