public class MyDate
extends java.util.GregorianCalendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET| Modifier and Type | Method and Description |
|---|---|
MyDate |
clone()
Creates a new MyDate object identical to this.
|
int |
getDay()
Returns the year of this MyDate object.
|
int |
getMonth()
Returns the month of this MyDate object.
|
int |
getYear()
Returns the year of this MyDate object.
|
void |
incDay(int k)
Adds k days to the current date.
|
void |
incMonth(int k)
Adds k months to the current date.
|
void |
incYear(int k)
Adds k years to the current date.
|
static MyDate |
makeDate(int y,
int m,
int d)
Returns a new MyDate object initialized to thegiven year, month and day.
|
java.lang.String |
toString()
Returns a String representation of this MyDate in the usual mm/dd/yyyy format.
|
add, computeFields, computeTime, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, getWeeksInWeekYear, getWeekYear, hashCode, isLeapYear, isWeekDateSupported, roll, roll, setGregorianChange, setTimeZone, setWeekDateafter, before, clear, clear, compareTo, complete, get, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillispublic static MyDate makeDate(int y, int m, int d)
MyDate dt = makeDate(2015,1,17); // makes 17 January 2015.
public int getYear()
public int getMonth()
public int getDay()
public void incYear(int k)
public void incMonth(int k)
public void incDay(int k)
public MyDate clone()
MyDate A = makeDate(2015,3,18); MyDate B = A; B.incDay(3);both A and B refer to the same MyDate object 3/21/2015. On the other hand, after
MyDate C = makeDate(2015,3,18); MyDate D = C.clone(); D.incDay(3);D refers to MyDate object 3/21/2015, while C refers to MyDate object 3/18/2015.
clone in class java.util.GregorianCalendarpublic java.lang.String toString()
toString in class java.util.Calendar