SimpleDateFormat的pattern的规则:
https://zy-email1991.iteye.com/blog/2243021
- 将“20181017101000” 转化成为“2018-10-17 10:10:00”
String aDate = "20181017101000";
DateFormat formatter1= new SimpleDateFormat("yyyyMMddHHmmss");
DateFormat formatter2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date1 = formatter1.parse(aDate);
String aDateFormat = formatter2.format(date1);
2.将“22 February, Fri, 2019” 转为“2018-02-22”
格式大全:https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns
3.英文时间格式
https://www.iteye.com/blog/snannan268-914349
Locale locale = Locale.English;
String dateStr = "17/Mar/2003 11:30:51";
SimpleDateFormat frm = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss", locale);
Date date = frm.parse(dateStr);
SimpleDateFormat frm1 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", locale);
System.out.println("reformat : " + frm1.format(date));