标签:java for ar 2014 sp new ef c 字符串
1、日期转换成字符串
Date da = new Date();
String dd = df.format(da);
System.out.println(dd);
2、字符转换成日期
String s1 = "Tue Aug 26 16:50:51 CST 2014";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy",java.util.Locale.ENGLISH);
Date d1 = df2.parse(s1);
String ss = df.format(d1);
System.out.println(ss);
String s2 = "Tue Aug 26 16:50:51 CST 2014";
Date d2 = new Date(s2);
String sss = df.format(d2);
System.out.println(sss);
标签:java for ar 2014 sp new ef c 字符串
原文地址:http://www.cnblogs.com/Struts-pring/p/3937665.html