Answers for "how to attach time to localdate in java"

0

how to turna date into a LocalDateTime java

public LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
    return dateToConvert.toInstant()
      .atZone(ZoneId.systemDefault())
      .toLocalDateTime();
}
Posted by: Guest on February-10-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 "how to attach time to localdate in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language