public static void main(String[] args) throws ParseException {
stringParseToDate();
}
private static void stringParseToDate() throws ParseException {
String str = "2018-02-14";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(str);
System.out.println(date);
}
SimpleDateFormat类的parse()函数
最新推荐文章于 2023-05-26 01:09:58 发布