|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.vignette.portal.util.DateUtils
A set of date related utilities to supplement Calendar. This class is used by first obtaining
a DateUtils instance via one of the available getInstance() methods. Whenever the time zone is known to
be different than the default system time zone, the method DateUtils.getInstance(TimeZone) should be used here.
| Method Summary | |
int |
diffInDays(Date date1,
Date date2)
Determine the number of days difference between two dates. |
long |
diffInSecs(Date date1,
Date date2)
Determine the number of seconds between two dates. |
boolean |
equalsIgnoreTime(Date date1,
Date date2)
Determine if two Date objects are refering to the same day. |
static DateUtils |
getInstance()
Retrieve an instance of DateUtils using the default Locale and Timezone of the current server. |
static DateUtils |
getInstance(TimeZone zone)
Retrieve an instance of DateUtils using the default Locale of the current server and the specified Timezone. |
String |
getISODateStamp(Date date)
Return a date as a date string formatted using ISO 8601 conventions. |
String |
getISODateTimeStamp(Date date)
Return a date as a date and time string formatted using ISO 8601 conventions. |
boolean |
isToday(Date then)
Determine if the specified Date refers to today. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static DateUtils getInstance(TimeZone zone)
zone - The TimeZone to use for all operations that are TimeZone specific.public static DateUtils getInstance()
public boolean equalsIgnoreTime(Date date1,
Date date2)
The comparison is relative to the TimeZone, such that for example if GMT is being used (in DateUtils.getInstance(TimeZone)) -
if the first date was generated at 11pm in San Francisco (1am New York) and the second date is generated in New York
at 1:30am (the "following" day) the result is true because both days are actually
the same day in GMT.
date1 - One of two dates to be compared.date2 - One of two dates to be compared.true iff both dates refer to the same Year, Month, and Date (at GMT).public boolean isToday(Date then)
then - The date upon which to evaluate if it's today or a different day.true iff the specified Date is today (in the currently used TimeZone).DateUtils.equalsIgnoreTime(Date, Date)
public int diffInDays(Date date1,
Date date2)
Math.abs(int) on the result if a positive integer is
desired.date1 - One side of the dfference operation.date2 - One side of the dfference operation.
public long diffInSecs(Date date1,
Date date2)
Math.abs(long) on the result if a positive long is desired.date1 - One side of the difference operation.date2 - One side of the difference operation.public String getISODateTimeStamp(Date date)
date - The date to be formatted.public String getISODateStamp(Date date)
date - The date to be formatted.
|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||