String ---> Date 解析parse()
String time = “2015-09-28 10:11:55”;
String geshi = “yyy-MM-dd HH:mm:ss”;
SimpleDateFormat sdf = new SimpleDateFormat(geshi);
Date d2 = sdf.parse(time);
System.out.println(d2);
Date - -> String
Date d = new Date();
String geshi = “yyyy年MM月dd日 HH:mm:ss”;
SimpleDateFormat sdf = new SimpleDateFormat(geshi);
String time = sdf.format(d);
|
|