天天看點

Java時間格式轉換yyyyMMddHHmmss--yyyy-MM-dd HH:mm:ss

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");
}