Sie sind auf Seite 1von 3

GregorianCalendar() constructs a calendar object that represents the current time in the default time zone with the

default locale.

GregorianCalendar(int year, int month, int date) constructs a Gregorian calendar with the given date.

Parameters: year
month date

the year of the date the month of the date. This value is 0-based; for example, 0 for January the day of the month

GregorianCalendar(int year, int month, int date, int hour, int minutes, int seconds) constructs a Gregorian calendar with the given date and time.

Parameters: year
month date hour minutes seconds

the year of the date the month of the date. This value is 0-based; for example, 0 for January the day of the month the hour (between 0 and 23) the minutes (between 0 and 59) the seconds (between 0 and 59)

boolean equals(Object when) compares this calendar object with when and returns true if the objects represent the same point in time.

boolean before(Object when) compares this calendar object with when and returns true if it comes before when.

boolean after(Object when) compares this calendar object with when and returns true if it comes after when.

int get(int field) gets the value of a particular field.

Parameters: field one of Calendar.ERA, Calendar.YEAR,

Calendar.MONTH, Calendar.WEEK_OF_YEAR, Calendar.WEEK_OF_MONTH, Calendar.DAY_OF_MONTH, Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK, Calendar.DAY_OF_WEEK_IN_MONTH, Calendar.AM_PM, Calendar.HOUR, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND, Calendar.ZONE_OFFSET, Calendar.DST_OFFSET

void set(int field, int value) sets the value of a particular field.

Parameters:

field value

one of the constants accepted by get the new value

void set(int year, int month, int day) sets the date fields to a new date.

Parameters: year
month day

the year of the date the month of the date. This value is 0-based; for example, 0 for January the day of the month

void set(int year, int month, int day, int hour, int minutes, int seconds) sets the date and time fields to new values.

Parameters: year
month day hour minutes seconds

the year of the date the month of the date. This value is 0-based; for example, 0 for January the day of the month the hour (between 0 and 23) the minutes (between 0 and 59) the seconds (between 0 and 59)

void add(int field, int amount)

is a date arithmetic method. Adds the specified amount of time to the given time field. For example, to add 7 days to the current calendar date, call c.add(Calendar.DAY_OF_MONTH, 7).

Parameters: field
amount

the field to modify (using one of the constants documented in the get method) the amount by which the field should be changed (can be negative)

void setTime(Date time) sets this calendar to the given point in time.

Parameters:
Date getTime()

Time

a point in time

gets the point in time that is represented by the current value of this calendar object.

Das könnte Ihnen auch gefallen