Description: This article is talking about the difference between LocalDate and Date in Java. Because most of the time, I can not distinguish them clearly, so write this article to record it.
LocalDate: only shows the date not include the specific time
Date: can records specific time
Example:
1
2
3
4
5System.out.println("this is LocalDate: "+LocalDate.now());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
System.out.println("this is date: "+dateFormat.format(date));