|
Re: Creating a Calendar
|
Posted: Apr 8, 2003 9:54 AM
|
|
public String CalendarDate(int M, int D, int Y){
GregorianCalendar myCal = new GregorianCalendar(Y,M-1,D); //Month is 0 based so January is 0 myCal.roll(GregorianCalendar.DAY_OF_MONTH,1); return myCal.toString(); }
Go through this method and the API for java.util.GregorianCalendar and you should be able to do the rest. Here are some extracts from the API
System.out.println("YEAR: " + calendar.get(Calendar.YEAR)); System.out.println("MONTH: " + calendar.get(Calendar.MONTH)); System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR)); System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH)); System.out.println("DATE: " + calendar.get(Calendar.DATE)); System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH)); System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR)); System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK)); System.out.println("DAY_OF_WEEK_IN_MONTH: " + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
|
|