使用DateLocaleConverter:
public static void change() { String birthday = "1990-12-32"; DateLocaleConverter conv = new DateLocaleConverter(); conv.convert(birthday,"yyyy-MM-dd"); }
使用SimpleDateFormat:
String birthday = "1990-12-32"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse(birthday);