这样应该可以吧:
Calendar ca = Calendar.getInstance();
ca.setTime(someDate); // someDate 为你要获取的那个月的时间
ca.set(Calendar.DAY_OF_MONTH, 1);
Date firstDate = ca.getTime();
ca.add(Calendar.MONTH, 1);
ca.add(Calendar.DAY_OF_MONTH, -1);
Date lastDate = ca.getTime();

解决方案 »

  1.   

    各种时间的操作:http://www.huaxin99.com.cn/fqfblog/showlog.asp?cat_id=34&log_id=526
      

  2.   

    java.util.Date today=new java.util.Date();
    today.setDate(1);
    today.setTime(today.getTime()-today.getHours()*60*60*1000-today.getMinutes()*60*1000-today.getSeconds()*1000-today.getTime()%1000);
    Timestamp startTime=new Timestamp(today.getTime());//将日期置为下个月的这个时候
    if(today.getMonth()==11)
    {
    today.setMonth(0);
    today.setYear(today.getYear()+1);
    }
    else
    {
    today.setMonth(today.getMonth()+1);
    }
    Timestamp endTime=new Timestamp(today.getTime());//现在就可以用了
    System.out.println(startTime);
    System.out.println(endTime);
      

  3.   

    还是 linhao315(浩哥) 的简洁,以后用你的代码