public static void main(String[] args) throws ParseException {
String startStr = "1995.1.1 00:00:00";
String endStr = "1995.12.31 23:59:59";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
Date start = sdf.parse(startStr);
Date end = sdf.parse(endStr);
System.out.println(start);
System.out.println(end);
System.out.println(start.getYear() + 1900);
System.out.println(start.getMonth() + 1);
System.out.println(start.getDate());
System.out.println(end.getHours());
System.out.println(end.getMinutes());
System.out.println(end.getSeconds());
String a = (start.getYear() + 1900) + "." + (start.getMonth() + 1) + "." + start.getDate() + " " + end.getHours() + ":" + end.getMinutes() + ":" + end.getSeconds();
Date result = sdf.parse(a);
System.out.println(result);
}
Sun Jan 01 00:00:00 CST 1995
Sun Dec 31 23:59:59 CST 1995
1995
1
1
23
59
59
Sun Jan 01 23:59:59 CST 1995
Process finished with exit code 0