Java时间格式转换
String reg = "(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})"; String date = "20190516093040"; /** * yyyyMMddHHmmss-->yyyy-MM-dd HH:mm:ss **/ public static String getDateStr( String date ){ date = date.replaceAll(reg, "$1-$2-$3 $4:$5:$6"); }