1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

修改了 “Java8 新特性 Date-Time API 格式化” 示例代码的注释

日期格式化 Java 8 之前的示例代码,原注释有误,与示例代码不对应,故此修正
This commit is contained in:
江南笑书生 2022-10-08 22:13:58 +08:00 committed by GitHub
parent 681c5aeef7
commit 3741cfcf3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -766,8 +766,8 @@ LocalTime.class //时间 format: HH:mm:ss
```java ```java
public void oldFormat(){ public void oldFormat(){
Date now = new Date(); Date now = new Date();
//format yyyy-MM-dd HH:mm:ss //format yyyy-MM-dd
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(now); String date = sdf.format(now);
System.out.println(String.format("date format : %s", date)); System.out.println(String.format("date format : %s", date));