|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--prog.utils.MyDate
This wrapper class for Calendar provides various date-related utilities.
Field Summary | |
java.util.Calendar |
calendar
The Calendar wrapped in this instance of MyDate. |
java.lang.String |
date
The date in "month day, year" form, such as Oct 23, 1982. |
java.lang.String |
day
The 0-padded day number, such as 03, 20, and 07. |
int |
dayInt
The numerical day of the month, such as 3. |
java.lang.String |
dayOfWeek
The day of the week, such as Wed and Fri. |
java.lang.String |
month
The month, such as Oct and Mar. |
int |
monthInt
The numerical month of the year, such as 2. |
java.lang.String |
monthNum
The 0-padded month number, such as 03, 10, and 11. |
java.lang.String |
priorYear
The year before the year of this MyDate, such as 1985. |
java.lang.String |
time
The military time, such as 15:34:23. |
java.lang.String |
timestamp
The date in timestamp form, such as Sat Oct 20 17:32:52 PDT 2001. |
java.lang.String |
year
The year, such as 1986. |
int |
yearInt
The four-digit year number, such as 1987. |
java.lang.String |
yymmdd
The date in yymmdd form, such as 010205 for 2001 Feb 5. |
java.lang.String |
yyyymmdd
The date in yyyymmdd form, such as 20010205 for 2001 Feb 5. |
java.lang.String |
zone
The timezone, such as PST. |
Constructor Summary | |
MyDate()
Initializes the Calendar of this object to today. |
|
MyDate(java.util.Calendar cal)
Initializes the Calendar of this object to cal. |
Method Summary | |
int |
compareTo(java.lang.Object ob2)
Returns -1 if this MyDate is earlier in time than ob2, 0 if the same and 1 if later. |
static MyDate |
daysAgo(int days)
Returns a MyDate object that is 'days' number of days before today. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
monthsAgo(int ago)
Returns the 0-padded month number of the month that is 'ago' months before the month of this MyDate. |
java.lang.String |
toString()
Prints the values of the variables of the MyDate instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.util.Calendar calendar
public java.lang.String timestamp
public java.lang.String dayOfWeek
public java.lang.String day
public java.lang.String month
public java.lang.String time
public java.lang.String zone
public java.lang.String year
public java.lang.String date
public java.lang.String monthNum
public java.lang.String priorYear
public java.lang.String yymmdd
public java.lang.String yyyymmdd
public int dayInt
public int monthInt
public int yearInt
Constructor Detail |
public MyDate()
public MyDate(java.util.Calendar cal)
Method Detail |
public int compareTo(java.lang.Object ob2)
compareTo
in interface java.lang.Comparable
public static MyDate daysAgo(int days)
public java.lang.String monthsAgo(int ago)
public java.lang.String toString()
timestamp : Sat Oct 20 17:32:52 PDT 2001 dayOfWeek : Sat day : 20 month : Oct time : 17:32:52 zone : PDT year : 2001 date : Oct 20, 2001 priorYear : 2000 dayInt : 20 monthInt : 10 yearInt : 2001 yymmdd : 011020 yyyymmdd : 20011020
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |