I want to select the entries that created the date between the first and last day of this month. I calculate the month from the beginning and ending as follows:
The month date is just a random date inside the timeframe
Calendar cal = Calendar.getInstance();
cal.setTime(month);
int endday = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
int actualmonth = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
Date begin = format.parse("01." + actualmonth + "." + year);
Date end = format.parse(endday + "." + actualmonth + "." + year);
When I think about it, I will also need to set the daytime to avoid skipping entries on the last day of the month.
I feel this kinda ridiculous, anyone for a better solution?
source
share