Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

I want to convert java.time.LocalDate into java.util.Datetype. Because I want to set the date into JDateChooser. Or is there any date chooser that supports java.time dates?

1 Answer

0 votes
by (46k points)

Try:

Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());

This feigns your date chooser accepts the system default timezone to convert dates toward strings.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 12, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...