闰年也只有2月是29天呀对于其他月份是不变的呀。
用数组等都可以完全或者VECTOR或者HASHTABLE就可以做出来,
仔细想想,应该很简单的

解决方案 »

  1.   

    java里面已经给你实现得很好乐
      

  2.   

    有没有具体的java api 可以直接调用啊
      

  3.   

    java里面已经给你实现得很好乐  
      对日期部分不太懂,痛苦啊
      

  4.   

    hashtable  和 vector  在 java2 里已经不推荐使用了
      

  5.   

    Calendar c= Calendar.getInstance();
     c.set(2004, 4,1);
     /*
      * Date Arithmetic function.
      * Adds the specified (signed) amount of time to the given time field,
      * based on the calendar's rules.
      */
     c.add(Calendar.DATE, 1);
      

  6.   

    weihy(skr) ( ) 的解法,可以给些注解吗?
      

  7.   

    Calendar c= Calendar.getInstance();
     c.set(2004, 4,1);
     /*
      * Date Arithmetic function.
      * Adds the specified (signed) amount of time to the given time field,
      * based on the calendar's rules.
      */
     c.add(Calendar.DATE, 1);
    for your problem,you can write
    void listDays()
    {
      Calendar c1= Calendar.getInstance();
      Calendar c2= Calendar.getInstance();
      c1.set(2003, 2,11);
      c2.set(2003, 5,1);
      while(!c1.equals(c2))
    {
       c1.add(Calendar.DATE, 1);
       System.out.println(c1.get(Calendar.YEAR).toString()
                         +c1.get(Calendar.MONTH).toString()
                         +c1.get(Calendar.DATE).toString());
    }
    }
    above is what weihy(skr)'s snippet means
      

  8.   

    goodsong,我把你的代码运行了一下,
    import java.util.*;class DateTest{
    public static void main(String[] args){
    Calendar c1= Calendar.getInstance();
       Calendar c2= Calendar.getInstance();
       c1.set(2003, 2,11);
      c2.set(2003, 5,1);
       while(!c1.equals(c2))
       {
        c1.add(Calendar.DATE, 1);
        System.out.println(c1.get(Calendar.YEAR)+"年"
                              +c1.get(Calendar.MONTH)+"月"
                           +c1.get(Calendar.DATE)+"日");
    }
    }
    }发现2月竟然有31天,不知道是什么原因,盼给个解释!!!!1
      

  9.   

    请仔细查看Calendar类的API Doc:
    month - the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
    月是从0开始的!希望楼主能都看看文档!
      

  10.   

    也可以用Date类实现:
    Date date1 = new Date(104, 1, 11);  //2004年2月11日
    Date date2 = new Date(104, 4, 11);  //2004年5月11日
    long x=date1.getTime();
    long y=date2.getTime();
    for(long i=x;i<=y;i=i+24*60*60*1000) {
    Date dateTemp=new Date(i);
       System.out.println(dateTemp);  //所有的天
    }Data类会自动处理闰年的问题
      

  11.   

    what I have said was "above is what weihy(skr)'s snippet means"
    I feel so sorry I only used five APIs and you didn't read the API documents carefully yourself.
    I'm a little happy that the result is not correct
    If you got the correct answer, you just learned Ctrl+C and Ctrl+V
    This won't help you to be an excellent man
      

  12.   

    public final void set(int year,
                          int month,
                          int date)Sets the values for the fields year, month, and date. Previous values of other fields are retained. If this is not desired, call clear first. Parameters:
    year - the value used to set the YEAR time field.
    >>month - the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
    date - the value used to set the DATE time field.
     
    above is what danceflash(Wine) means
    if you want to set the date 2003-2-11,you should write
    cl.set(2003,1,11) and also 
    System.out.println(c1.get(Calendar.YEAR)+"年"
                              +(c1.get(Calendar.MONTH)+1)+"月"
                           +c1.get(Calendar.DATE)+"日");
      

  13.   

    SimpleDateFormat format  = new SimpleDateFormat("yyyy-MM-dd");
    Date date1 = format.parse(beforDate);
    Date date2 = format.parse(afterDate);
    long decrease = (Util.getDateBetween(date1,date2))/1000/3600/24;
    int dateDiff = (int)decrease;
                return dateDiff;
      

  14.   

    Before learn anything, make sure you are ready to learn,
    or you'll learn nothing也可以用Date类实现:
    Date date1 = new Date(104, 1, 11);  //2004年2月11日
    Date date2 = new Date(104, 4, 11);  //2004年5月11日
    long x=date1.getTime();
    long y=date2.getTime();
    for(long i=x;i<=y;i=i+24*60*60*1000) {
    Date dateTemp=new Date(i);
       System.out.println(dateTemp);  //所有的天
    }Data类会自动处理闰年的问题if above snippet could get the correct result,will you copy it?
    Please see the API documents and decided by yourself