程序出错了,帮改改吧,谢谢
//此程序得不到准确时间!,就是与任务栏上的日期时间不同,慢了一个月,是编程出错还是什么原因?希望得到指导,谢谢import java.util.*;
import java.text.SimpleDateFormat;
public class TestCalendar {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
// TODO: Add your code here
Calendar cd = Calendar.getInstance();
System.out.println(cd.get(cd.YEAR)+"年" + cd.get(cd.MONTH) + "月" + cd.get(cd.DAY_OF_MONTH) + "日" + cd.get(cd.HOUR_OF_DAY) + ":" + cd.get(cd.MINUTE) + ":" +cd.get(cd.SECOND));
cd.add(cd.DAY_OF_YEAR,315);
System.out.println(cd.get(cd.YEAR)+"年" + cd.get(cd.MONTH) + "月" + cd.get(cd.DAY_OF_MONTH) + "日" + cd.get(cd.HOUR_OF_DAY) + ":" + cd.get(cd.MINUTE) + ":" +cd.get(cd.SECOND));
}
}