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:
parent
681c5aeef7
commit
3741cfcf3b
@ -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));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user