mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-16 18:10:13 +08:00
示例代码修正
This commit is contained in:
parent
07cc257b74
commit
889493fd93
@ -798,6 +798,7 @@ public void newFormat(){
|
|||||||
//format yyyy-MM-dd HH:mm:ss
|
//format yyyy-MM-dd HH:mm:ss
|
||||||
LocalDateTime dateTime = LocalDateTime.now();
|
LocalDateTime dateTime = LocalDateTime.now();
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String dateTimeStr = dateTime.format(dateTimeFormatter);
|
||||||
System.out.println(String.format("dateTime format : %s", dateTimeStr));
|
System.out.println(String.format("dateTime format : %s", dateTimeStr));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user