parent
29e1d31de7
commit
27afde4001
@ -0,0 +1,19 @@
|
||||
// Timemanage.java
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 时间管理工具类。
|
||||
*/
|
||||
public class TimeManager {
|
||||
public static void main(String[] args) {
|
||||
TimeManager timeManager = new TimeManager();
|
||||
System.out.println(timeManager.getCurrentTime());
|
||||
}
|
||||
|
||||
public String getCurrentTime() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年-MM月-dd日-HH时-mm分-ss秒");
|
||||
return now.format(formatter);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue