|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.GDate | +--com.javaranch.common.ADate
Gregorian Date, american format (MM/DD/YYYY).
These dates are stored as Year, Month and Day. Not very memory efficient, but good for converting to strings, or quickly extracting the day of the month.
See the complimentary class JDate for memory efficiency or doing date math.
This object uses the american MM/DD/YYYY format. See GDate for YYYY/MM/DD format.
Constructor Summary | |
ADate()
Create a Gregorian Date object with a default of today's date. |
|
ADate(GDate d)
Create a Gregorian Date object from another Gregorian Date object (GDate or ADate). |
|
ADate(int year,
int month,
int day)
Create a Gregorian Date object with a specific date. |
|
ADate(JDate j)
Create a Gregorian Date object with a specific Julian date. |
|
ADate(java.lang.String textDate)
Create a Gregorian Date object with a loosely formatted text date. |
|
ADate(java.sql.Timestamp t)
Create a Gregorian Date object based on today's date. |
|
ADate(java.util.TimeZone timeZone)
Create a Gregorian Date object with a default of today's date. |
Method Summary | |
java.lang.Object |
clone()
Get a copy of this object. |
java.lang.String |
getFixedFormat()
Such as "05/01/2000". |
static java.sql.Timestamp |
getTimestamp(java.lang.String textDate)
|
void |
set(java.lang.String textDate)
Force the date based on the contents of a string. |
java.lang.String |
toString()
Returns a date formatted like "7/24/2000". |
static java.lang.String |
toString(GDate g)
Returns a date formatted like "7/24/2000". |
Methods inherited from class com.javaranch.common.GDate |
equals, getDay, getLongFormat, getMonth, getMonthString, getMonthString, getShortFormat, getTimestamp, getTimestamp, getToday, getYear, setDay, setMonth, setToToday, setYear |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ADate(java.util.TimeZone timeZone)
public ADate()
public ADate(int year, int month, int day)
public ADate(JDate j)
public ADate(GDate d)
public ADate(java.sql.Timestamp t)
public ADate(java.lang.String textDate)
The general format is MM/DD/YYYY.
Any type of delimiter can be used (slash, hyphen, space, etc.). The month and date does not have to be two digits in length. The year does not have to be four digits in length, although "98" will be interpretted as 0098, not 1998 or 2098.
Invalid dates are accepted.
Method Detail |
public void set(java.lang.String textDate)
The general format is DD/MM/YYYY.
Any type of delimiter can be used (slash, hyphen, space, etc.). The month and date does not have to be two digits in length. The year does not have to be four digits in length, although "98" will be interpretted as 0098, not 1998 or 2098.
Invalid dates are accepted.
If you leave out the day of the month, the first is assumed.
If you leave out the month, January is assumed.
set
in class GDate
public java.lang.String getFixedFormat()
getFixedFormat
in class GDate
public static java.lang.String toString(GDate g)
public java.lang.String toString()
toString
in class GDate
public java.lang.Object clone()
clone
in class GDate
public static java.sql.Timestamp getTimestamp(java.lang.String textDate)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |