import java.util.*;
GregorianCalendar gc = new GregorianCalendar();
int today = gc.get(DAY_OF_YEAR);
//得到今天的日期,特定日期的也差不多,改个构造函数

解决方案 »

  1.   

    呵呵
    刚才太急了
    那个DAY_OF_YEAR
    应该是
    Calendar.DAY_OF_YEAR
      

  2.   

    呵呵,楼上的帮你解决了。
    static int AM 
              Value of the AM_PM field indicating the period of the day from midnight to just before noon. 
    static int AM_PM 
              Field number for get and set indicating whether the HOUR is before or after noon. 
    static int APRIL 
              Value of the MONTH field indicating the fourth month of the year. 
    protected  boolean areFieldsSet 
              True if fields[] are in sync with the currently set time. 
    static int AUGUST 
              Value of the MONTH field indicating the eighth month of the year. 
    static int DATE 
              Field number for get and set indicating the day of the month. 
    static int DAY_OF_MONTH 
              Field number for get and set indicating the day of the month. 
    static int DAY_OF_WEEK 
              Field number for get and set indicating the day of the week. 
    static int DAY_OF_WEEK_IN_MONTH 
              Field number for get and set indicating the ordinal number of the day of the week within the current month. 
    static int DAY_OF_YEAR 
              Field number for get and set indicating the day number within the current year. 
    static int DECEMBER 
              Value of the MONTH field indicating the twelfth month of the year. 
    static int DST_OFFSET 
              Field number for get and set indicating the daylight savings offset in milliseconds. 
    static int ERA 
              Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar. 
    static int FEBRUARY 
              Value of the MONTH field indicating the second month of the year. 
    static int FIELD_COUNT 
              The number of distinct fields recognized by get and set. 
    protected  int[] fields 
              The field values for the currently set time for this calendar. 
    static int FRIDAY 
              Value of the DAY_OF_WEEK field indicating Friday. 
    static int HOUR 
              Field number for get and set indicating the hour of the morning or afternoon. 
    static int HOUR_OF_DAY 
              Field number for get and set indicating the hour of the day. 
    protected  boolean[] isSet 
              The flags which tell if a specified time field for the calendar is set. 
    protected  boolean isTimeSet 
              True if then the value of time is valid. 
    static int JANUARY 
              Value of the MONTH field indicating the first month of the year. 
    static int JULY 
              Value of the MONTH field indicating the seventh month of the year. 
    static int JUNE 
              Value of the MONTH field indicating the sixth month of the year. 
    static int MARCH 
              Value of the MONTH field indicating the third month of the year. 
    static int MAY 
              Value of the MONTH field indicating the fifth month of the year. 
    static int MILLISECOND 
              Field number for get and set indicating the millisecond within the second. 
    static int MINUTE 
              Field number for get and set indicating the minute within the hour. 
    static int MONDAY 
              Value of the DAY_OF_WEEK field indicating Monday. 
    static int MONTH 
              Field number for get and set indicating the month. 
    static int NOVEMBER 
              Value of the MONTH field indicating the eleventh month of the year. 
    static int OCTOBER 
              Value of the MONTH field indicating the tenth month of the year. 
    static int PM 
              Value of the AM_PM field indicating the period of the day from noon to just before midnight. 
    static int SATURDAY 
              Value of the DAY_OF_WEEK field indicating Saturday. 
    static int SECOND 
              Field number for get and set indicating the second within the minute. 
    static int SEPTEMBER 
              Value of the MONTH field indicating the ninth month of the year. 
    static int SUNDAY 
              Value of the DAY_OF_WEEK field indicating Sunday. 
    static int THURSDAY 
              Value of the DAY_OF_WEEK field indicating Thursday. 
    protected  long time 
              The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT. 
    static int TUESDAY 
              Value of the DAY_OF_WEEK field indicating Tuesday. 
    static int UNDECIMBER 
              Value of the MONTH field indicating the thirteenth month of the year. 
    static int WEDNESDAY 
              Value of the DAY_OF_WEEK field indicating Wednesday. 
    static int WEEK_OF_MONTH 
              Field number for get and set indicating the week number within the current month. 
    static int WEEK_OF_YEAR 
              Field number for get and set indicating the week number within the current year. 
    static int YEAR 
              Field number for get and set indicating the year. 
    static int ZONE_OFFSET 
              Field number for get and set indicating the raw offs