猿问

java怎么把20161011转化为2016-10-11

怎么把20161011转化为2016-10-11

String time = "20161011";
怎么转换成:
String time1 = "2016-10-11";


ibeautiful
浏览 417回答 1
1回答

蛊毒传说

String x = "20161111";System.out.println(x.replaceAll("(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3"));
随时随地看视频慕课网APP

相关分类

Java
我要回答