try to study and use this simple calendar format
heres a 2 simpe proram
NOTE: these are different with each other
public class CalendarFormat2 {
public static void main(String[] args) {
GregorianCalendar cal = new GregorianCalendar( );
System.out.println("YEAR : " + GregorianCalendar.YEAR);
System.out.println("MONTH : " + GregorianCalendar.MONTH);
System.out.println("DATE :" + GregorianCalendar.DATE);
System.out.println("DAY_OF_YEAR: " + cal.DAY_OF_YEAR);
System.out.println("DAY_OF_MONTH: " + cal.DAY_OF_MONTH);
System.out.println("DAY_OF_WEEK: " + cal.DAY_OF_WEEK);
System.out.println("WEEK_OF_YEAR: " + cal.WEEK_OF_YEAR);
System.out.println("WEEK_OF_MONTH: " + cal.WEEK_OF_MONTH);
System.out.println("AM_PM: " + cal.AM_PM);
System.out.println("HOUR: " + cal.HOUR);
System.out.println("MINUTE: " + cal.MINUTE);
}
}
the second one:
/**
* @Program: Program that display the exact day of a given date using the
* GregorianCalendar class.
* The value of the date is accepted as Integer number.
*
* @author
*/
public class CalendarFormat4 {
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args)throws IOException {
int year,
month,
day;
GregorianCalendar cal;
SimpleDateFormat sdf;
System.out.print("Enter Year: ");
year = Integer.parseInt(br.readLine( ));
System.out.print("Enter Month:");
month = Integer.parseInt(br.readLine( ));
System.out.print("Enter Day: ");
day = Integer.parseInt(br.readLine( ));
cal = new GregorianCalendar(year, month-1, day);
sdf = new SimpleDateFormat("EEEE");
System.out.println("Day Of Week: " + sdf.format(cal.getTime( )));
}
}