废话少说,直接上代码
方式一
String s1 = "5:43 AM · Oct 9, 2020";
SimpleDateFormat format = new SimpleDateFormat("hh:mm a · MMM dd, yyyy", Locale.US);
Date d = format.parse(s1);
System.out.println(d);
方式二
DateTimeFormatter fmt = DateTimeFormat.forPattern("hh:mm a · MMM dd, yyyy").withLocale(Locale.US);
Date d = fmt.parseLocalDateTime(strDate).toDate();
System.out.println(d);
可按照自己使用的 format 类封装成DateUtils工具。