[Java] 纯文本查看 复制代码
阅读代码,说法错误的是? ()
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class SimpleDateFormatTest {
public static void main(String[] args) throws ParseException {
String str = "2018-04-11";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd");
// 将字符串转换成日期对象
Date date = sdf.format(str);
System.out.println(date);
}
}