title: How to convert ZonedDateTime to milliSecond in Java?
body: <p>I'm trying to convert ZonedDateTime to milliseconds using below code. </p>
  
  <pre><code>LocalDateTime ldt = LocalDateTime.now();
  ZonedDateTime zonedDateTime =ldt.atZone(ZoneId.of(""Asia/Kolkata""));
  zonedDateTime.toInstant().toEpochMilli();
  </code></pre>
  
  <p>But this one returns milliseconds based on local time. And it's not considering ZoneId.</p>
  
  <p>Let's say <code>LocalDateTime("2019-04-10T05:30")</code>. If I convert this to <code>ZonedDateTime</code> with Zone id ("Asia/Kolkata") then I'm getting (<code>"2019-04-10T05:30+05:30[Asia/Kolkata]"</code>). Then I convert to EpochMilli (1554854400000) = (<code>"Wed Apr 10 2019 00:00:00"</code>) in UTC.</p>