package day14_data_1;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateTest_1 {
public static void main(String[] args) throws ParseException {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss E");
String s = sdf.format(d);
System.out.println(s);
String s1 = "2003-1-1 00:00:00";
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d1 = sdf1.parse(s1);
System.out.println(d1);
}
}
|
|