Dateformat
1:日期格式化为字符串 str = df.format(date);
2: 字符串转换为日期 date = df.parse(str)
Date date = new Date();
System.out.println(date);
DateFormat dft = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
String str = dft.format(date);
System.out.println(str);
//calendar;
String str = "1995/7/16";
Date btd = null;
DateFormat dft = new SimpleDateFormat("yyyy/MM/dd");
try {
btd = dft.parse(str);
System.out.println(btd);
Calendar calendar =Calendar.getInstance();
calendar.setTime(btd);
calendar.add(calendar.DATE, 10000);
calendar.getTime();
Date newDate = calendar.getTime();
System.out.println(dft.format(newDate));
2: 字符串转换为日期 date = df.parse(str)
Date date = new Date();
System.out.println(date);
DateFormat dft = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
String str = dft.format(date);
System.out.println(str);
//calendar;
String str = "1995/7/16";
Date btd = null;
DateFormat dft = new SimpleDateFormat("yyyy/MM/dd");
try {
btd = dft.parse(str);
System.out.println(btd);
Calendar calendar =Calendar.getInstance();
calendar.setTime(btd);
calendar.add(calendar.DATE, 10000);
calendar.getTime();
Date newDate = calendar.getTime();
System.out.println(dft.format(newDate));