import java.util.Calendar;
public class Main {
public static void main(String[] args) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2007);
cal.set(Calendar.DAY_OF_YEAR, 180);
System.out.println("Calendar date is: " + cal.getTime());
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
System.out.println("Calendar day of month: " + dayOfMonth);
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
System.out.println("Calendar day of week: " + dayOfWeek);
}
}
|