我的Date Util格式化程序没有返回我想要的日期格式需要帮助,

时间:2018-06-18 02:36:16

标签: java

日期工具

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

0 个答案:

没有答案