Answers for "just the time in localdatetime java"

0

java instant to localdatetime

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

// ...

//Convert instant to LocalDateTime, no timezone, add a zero offset / UTC+0
LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC);
Posted by: Guest on January-15-2021
0

how to turna date into a LocalDateTime java

public LocalDateTime convertToLocalDateTimeViaMilisecond(Date dateToConvert) {
    return Instant.ofEpochMilli(dateToConvert.getTime())
      .atZone(ZoneId.systemDefault())
      .toLocalDateTime();
}
Posted by: Guest on February-10-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language