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();
时间: 2024-10-05 06:17:01