SimpleDateFormat sdt=new SimpleDateFormat(“yyyy/MM/dd”);
SimpleDateFormat sdf=new SimpleDateFormat(“yyyy-MM-dd”);
String date1=sdf.format(sdt.parse(“2021/04/20”));
运行结果:
SimpleDateFormat sdt=new SimpleDateFormat(“yyyy/MM/dd”);
SimpleDateFormat sdf=new SimpleDateFormat(“yyyy-MM-dd”);
String date1=sdf.format(sdt.parse(“2021/04/20”));
运行结果: