date 的类取得的月要加1。给分吧最好用日历的类calendar

解决方案 »

  1.   

    int Date1,Year,Month;
         long time; 
           java.util.Date today;
         today =new java.util.Date() ;
       Year=1900+today.getYear();
       Date1=today.getDate(); 
       Month=1+today.getMonth();
       date1=Year+"年"+Month+"月"+Date1+"日"; 
       time=today.getTime();
      

  2.   

    java.util.Date.getYear():
    getYear
    public int getYear()Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900. Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in time represented by this Date object, as interpreted in the local time zone. Returns:
    the year represented by this date, minus 1900.
    See Also:
    Calendar根据API里的这一段,可以看出,你取出的年是104,加上1900,正好是2004,没错。getMonth
    public int getMonth()Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.MONTH). Returns a number representing the month that contains or begins with the instant in time represented by this Date object. The value returned is between 0 and 11, with the value 0 representing January. Returns:
    the month represented by this date.
    See Also:
    Calendar根据API里的这一段,可以看出,你取出的月是10,加上1,正好是11,没错。