如果要将日期格式的一种日期字符串转换为另一种格式,则可以使用SimpleDateFormat类的format()和parse()方法
首先,您需要使用设置源模式的parse()方法将字符串解析为日期对象,然后使用设置目标模式的format()方法将日期对象格式化:
SimpleDateFormat sourceFormat = new SimpleDateFormat("MM-dd-yyyy");Date sourceFormatDate = sourceFormat.parse("08-05-2010");SimpleDateFormat destFormat = new SimpleDateFormat("dd-MMM-yy");String destFormatDateString = destFormat.format(sourceFormatDate);System.out.println(destFormatDateString); // 05-Aug-10


