https://blog.csdn.net/JOYuan_/article/details/120342354?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120342354-blog-114347476.pc_relevant_paycolumn_v3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-120342354-blog-114347476.pc_relevant_paycolumn_v3&utm_relevant_index=2
将yyyyMMddhhmmss格式转化成yyyy-MM-dd HH:mm:ss格式
String dateSource = “20220525102339”;
SimpleDateFormat sdf = new SimpleDateFormat(“yyyyMMddhhmmss”);
SimpleDateFormat df = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
Date dateSource1 = sdf.parse(dateSource);
String dateTarget = df.format(dateSource1);
系统转换时间格式方法(将yyyyMMddhhmmss格式转化成yyyy-MM-dd HH:mm:ss格式):
String nowTime = GTime.formatDate(GTime.getTime(), “yyyyMMddHHmmss”, “yyyy-MM-dd HH:mm:ss”);