Answers for "convert date to localdatetime java"

3

java 8 string to localdate

package com.mkyong.date;

import java.time.LocalDate;

public class JavaDateExample1 {

    public static void main(String[] args) {

        String date = "2016-08-16";

        //default, ISO_LOCAL_DATE
        LocalDate localDate = LocalDate.parse(date);

        System.out.println(localDate);

    }
}
Copy
Posted by: Guest on April-03-2020
0

how to parse a specific datetime to localdatetime

LocalDateTime date = LocalDateTime.parse("1995-07-25T15:03:45");
Posted by: Guest on August-07-2020
-1

local date to date java

public LocalDate convertToLocalDateViaInstant(Date dateToConvert) {
    return dateToConvert.toInstant()
      .atZone(ZoneId.systemDefault())
      .toLocalDate();
}
Posted by: Guest on December-04-2020

Code answers related to "convert date to localdatetime java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language