日期工具
public class DateUtil {
public static Date StringToDate(String date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.ENGLISH);
Date convertedDate = null;
try {
convertedDate = sdf.parse(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return convertedDate;
}
}
我称之为字符串输入
2018年6月8日
返回的值是
Fri Jun 08 00:00:00 CST 2018