标签:java oca pretty uil views news system name mat
String str = "Jul 2, 2016 3:05:26 PM";
SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss", Locale.ENGLISH);
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf1.parse(str);//提取格式中的日期
System.out.println("转换之前的日期:"+date);
String newStr = sdf2.format(date); //改变格式
System.out.println("转换之后的日期:"+newStr);
标签:java oca pretty uil views news system name mat
原文地址:http://www.cnblogs.com/Iran1112/p/6053703.html