import java.text.ParseException;
import java.text.SimpleDateFormat;
public class DateFormat {
public static void fun() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
String newDate;
String newDate1;
try {
newDate = sdf.format(new SimpleDateFormat("yyyyMMdd").parse("20170612"));
newDate1 = sdf1.format(new SimpleDateFormat("yyyyMMdd").parse("20170612"));
System.out.println(newDate);
System.out.println(newDate1);
} catch (ParseException e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
fun();
}
}