Calendar: getTime() : Calendar « java.util « Java by API






Calendar: getTime()

 
import java.util.Calendar;

public class Main {
  public static void main(String[] args) {
    int year = 2009;
    int month = 0; // January
    int date = 1;

    Calendar cal = Calendar.getInstance();
    cal.clear();

    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DATE, date);

    java.util.Date utilDate = cal.getTime();
    System.out.println(utilDate);
  }
}

   
  








Related examples in the same category

1.Calendar.AM_PM
2.Calendar.DATE
3.Calendar.DAY_OF_WEEK_IN_MONTH
4.Calendar: DAY_OF_WEEK
5.Calendar.DAY_OF_YEAR
6.Calendar.DST_OFFSET
7.Calendar.ERA
8.Calendar.HOUR
9.Calendar.HOUR_OF_DAY
10.Calendar.MILLISECOND
11.Calendar.MINUTE
12.Calendar.MONDAY
13.Calendar: TUESDAY
14.Calendar.SECOND
15.Calendar.SUNDAY
16.Calendar.WEEK_OF_MONTH
17.Calendar.WEEK_OF_YEAR
18.Calendar.YEAR
19.Calendar.ZONE_OFFSET
20.Calendar: add(int field, int amount)
21.Calendar: after(Object when)
22.Calendar: before(Object when)
23.Calendar: int get(int field)
24.Calendar: getActualMaximum(int field)
25.Calendar: getDisplayNames(int field, int style, Locale locale)
26.Calendar: getFirstDayOfWeek()
27.Calendar: getInstance()
28.Calendar: set(int field, int value)
29.Calendar: set(int year, int month, int date)
30.Calendar: setTime(Date date)
31.Calendar: setTimeInMillis(long millis)