package Study1;
import java.util.Calendar;
public class MyTest {
public static void main(String[] args) {
Calendar c1 = Calendar.getInstance();
System.out.println(c1.get(Calendar.YEAR)+"年"
+c1.get(Calendar.MONTH)+"月"
+c1.get(Calendar.DAY_OF_MONTH)+"日"
+c1.HOUR+":"+c1.MINUTE+":"+c1.SECOND);
c1.add(c1.DAY_OF_YEAR, 315);
System.out.println(c1.get(Calendar.YEAR)+"年"
+c1.get(Calendar.MONTH)+"月"
+c1.get(Calendar.DAY_OF_MONTH)+"日"
+c1.HOUR+":"+c1.MINUTE+":"+c1.SECOND);
}
}
结果:2011年6月20日10:12:13
2012年4月30日10:12:13 |