I have an excel file with dates in this format 31/08/13
. What I need to do is to calculate a monthly interest based on the dates. The problem is that I need to know the number of days of the month.
Here is how I'm getting the month name inside of a loop:
getMonth = new DateFormatSymbols().getMonths()[currentMonth-1]; //february
where getMonth
is a string and currentMonth
is the month number.
Now I'm trying to get the number of days with:
Calendar mycal = new GregorianCalendar(1999, Calendar.FEBRUARY, 1);
int daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH); // 28
My problem is that I can not(and its logic) replace FEBRUARY
with the getMonth
string, which is containing the month's name.
I know there is a much easier way to achieve it, but I'm really not able to spot it.