
I am create one program that contain three combo box. 1.cmbyear 2.cmbmonth 3.cmbweek
i am select year and month. then automatically calculate number of weeks in a specified month for the year.
for example if i choose year in 2008 and month in october then display number of weeks in cmbweek combo box. ex
1week 2week 3week 4week 5week
Please help me as soon as possible.

package com.test.dateutil;
import java.util.Calendar; /** * Code To calculate number of Days in a Month and number of weeks in a month * @author Lalit * */ public class GetDaysInMonth { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); int year = 1998; int month = Calendar.FEBRUARY; int date = 1; calendar.set(year, month, date); int numOfDaysInMonth = calendar.getActualMaximum(Calendar.DAYOFMONTH); int numOfWeeksInMonth = calendar.getActualMaximum(Calendar.WEEKOFMONTH); System.out.println("Number of Days In Month: " + numOfDaysInMonth); System.out.println("Number of Weeks In Month: " + numOfWeeksInMonth);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.