November 9, 2017
Java:获取当前日期 How to get current date time
In this tutorial, we will show you how to get the current date time from the classic Date and Calendar APIs, and also the new Java 8 date and time APIs – LocalDateTime and LocalDate
1. Code Snippets
For java.util.Date, just create a new Date()
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
System.out.println(… Read