Calendar set(int field, int value) - How to Set a Field in the Calendar object

public void set (int field, int value) was added in API level 1
Sets the given field to the given value.
The calendar object has many fields in it. Some of those fields are:
AM_PM, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DST_OFFSET, ERA, HOUR, HOUR_OF_DAY, MILLISECOND, MINUTE, MONTH, SECOND, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET

1. How to Declare a Calendar object

2. Add the below line of code to the onCreate method. This will set the Calendar.YEAR field in the Calendar object to 1999.

myCalendar.set(Calendar.YEAR, 1999);

3. Compile and run!

4. Below are the list of fields and their descriptions the Calendar can update.

AM_PM - indicating whether the HOUR is before or after noon.
DATE - indicating the day of the month.
DAY_OF_MONTH - indicating the day of the month.
DAY_OF_WEEK - indicating the day of the week.
DAY_OF_WEEK_IN_MONTH - indicating the ordinal number of the day of the week within the current month
DAY_OF_YEAR - indicating the day number within the current year.
DST_OFFSET - indicating the daylight savings offset in milliseconds.
ERA - indicating the era, e.g., AD or BC in the Julian calendar.
HOUR - indicating the hour of the morning or afternoon.
HOUR_OF_DAY - indicating the hour of the day.
MILLISECOND - indicating the millisecond within the second.
MINUTE - indicating the minute within the hour.
MONTH - indicating the month.
SECOND - indicating the second within the minute.
WEEK_OF_MONTH - indicating the week number within the current month.
WEEK_OF_YEAR - indicating the week number within the current year.
YEAR - indicating the year.
ZONE_OFFSET - indicating the raw offset from GMT in milliseconds.

Next Recommended Article: Calendar set(year, month, day) - How to Set a Date to the Calendar object

Resources:
http://developer.android.com/reference/java/util/Calendar.html#set(int, int)