String selectedDate = "2012-" + createdMonth + "-" + createdDay;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
createdDate = dateFormat.parse(selectedDate);
} catch (ParseException e1) {
e1.printStackTrace();
}
System.out.println(createdDate);
基本上当我打印 createdDate 时,它会显示如下内容:Thu Mar 08 00:00:00 CST 2012
而不是这种格式的“yyyy-MM-dd”。非常感谢!