String dateString = "2012-12-06 ";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd ");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd ");
Date date = sdf.parse(dateString);
System.out.println(sdf2.format(date));
string转Date转回String(JAVA)
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240803130933255-1404888097.jpg)