How to convert java util date into java.time LocalDate type.java.time is int the JDK 1.8 version.
Asked
Active
Viewed 2,552 times
0
-
2Java doesn't do date conversions unless you write some code. Voice to code facility is yet to be implemented. – devnull Apr 08 '14 at 05:29
-
1I'm asking how to convert the date.If i know the method,i won't ask this question here – Kavinda Gehan Apr 08 '14 at 05:32
-
Unless you make even a feeble attempt, chances are that you wouldn't get to know it either. – devnull Apr 08 '14 at 05:42
1 Answers
0
Try this:
Date inputDate = new Date();
LocalDate date = inputDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
I found this duplicated post after answer: Convert java.util.Date to java.time.LocalDate

Community
- 1
- 1

Andynedine
- 441
- 5
- 20
-
please. I want to convert localdate into date type.Because i want to set the date into jdate chooser – Kavinda Gehan Apr 08 '14 at 05:56
-
-
-
-
I hope this help you!! http://stackoverflow.com/questions/5597671/how-to-convert-joda-localdate-to-java-util-date – Andynedine Apr 08 '14 at 06:06
-
No.Its not Joda localdate.This local date contain in the java.time library.Those methods not works – Kavinda Gehan Apr 08 '14 at 06:16
-
Ahhmm!! OK. This one?? Joda localdate to java.util.date: http://stackoverflow.com/questions/5597671/how-to-convert-joda-localdate-to-java-util-date – Andynedine Apr 08 '14 at 06:19
-
No.Its not joda time.Its java.time.LocalDate;.Comes with JDK8.Joda Library methods not works :( – Kavinda Gehan Apr 08 '14 at 06:24
-
Check that codes and answers: http://stackoverflow.com/questions/2009795/using-groovyor-java-how-can-i-convert-a-org-joda-time-localdatetime-to-a-java – Andynedine Apr 08 '14 at 06:34
-
The user should change the project source binary format in project properties to JDK 8 – Kavinda Gehan Jul 29 '14 at 14:13