convert local datetime to instant java

Solutions on MaxInterview for convert local datetime to instant java by the best coders in the world

showing results for - "convert local datetime to instant java"
Solène
16 Jun 2020
1covert localdatetime to Instant object 
2LocalDateTime().now().toInstant(ZoneOffset.UTC)
Elias
25 Apr 2018
1import java.time.Instant;
2import java.time.LocalDateTime;
3import java.time.ZoneOffset;
4
5// ...
6
7//Convert instant to LocalDateTime, no timezone, add a zero offset / UTC+0
8LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC);
9