您的目标字符串格式为
EEE MMM dd HH:mm:ss zzz yyyy格式。因此,您需要使用
EEE MMM dd HH:mm:ss zzzyyyy而不是用作模式
yyyy-MM-dd。
String target = "Thu Sep 28 20:29:30 JST 2000"; DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); Date result = df.parse(target); System.out.println(result);如果要转换Date对象(即result),
yyyy-MM-dd请使用以下代码。
DateFormat dfDateToStr = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); String formattedDate = dfDateToStr.format(result); System.out.println("Formatted Date String : "+formattedDate);


