|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgnash.util.DateUtils
public class DateUtils
Static methods to make working with dates a bit easier
| Field Summary | |
|---|---|
private static java.lang.ref.WeakReference<java.util.Calendar> |
wC
WeakReference to the reusable Calendar instance |
private static java.lang.ref.WeakReference<java.util.Calendar> |
wGc
WeakReference to the reusable GregorianCalendar instance |
| Constructor Summary | |
|---|---|
private |
DateUtils()
|
| Method Summary | |
|---|---|
static boolean |
after(java.util.Date d1,
java.util.Date d2)
Determines is Date d1 occurs after Date d2. |
static boolean |
after(java.util.Date d1,
java.util.Date d2,
boolean inclusive)
Determines if Date d1 occurs after Date d2. |
static boolean |
before(java.util.Date d1,
java.util.Date d2)
Determines if Date d1 occurs before Date d2. |
static boolean |
before(java.util.Date d1,
java.util.Date d2,
boolean inclusive)
Determines if Date d1 occurs before Date d2. |
static java.util.Date |
firstDayOfMonth(java.util.Date date)
Returns a leveled date representing the first day of the month based on a specified date. |
private static java.util.Calendar |
getCal()
|
private static java.util.GregorianCalendar |
getGCal()
|
private static java.util.Date[] |
getQuarterBounds(java.util.Date date)
Returns an array of quarter bound dates of the year based on a specified date. |
static int |
getQuarterNumber(java.util.Date date)
Returns the number of the quarter (i.e. |
static java.text.DateFormat |
getShortDateFormat()
Generates a customized DateFormat with constant width for all dates. |
static java.util.Date |
lastDayOfMonth(java.util.Date date)
Returns a leveled date representing the last day of the month based on a specified date. |
static java.util.Date |
lastDayOfMonth(int month,
int year)
Returns a leveled date representing the last day of the month |
static java.util.Date |
lastDayOfQuarter(java.util.Date bdate)
Returns a leveled date representing the last day of the quarter based on a specified date. |
static java.util.Date |
lastDayOfYear(java.util.Date date)
Returns a leveled date representing the last day of the year based on a specified date. |
static java.util.List<java.util.Date> |
lastDaysOfMonth(java.util.Date startDate,
java.util.Date endDate)
Generates an array of dates ending on the last day of every month between the start and stop dates. |
static java.util.Date[] |
lastDaysOfMonth(int year)
Generates an array of dates ending on the last day of every month in the specified year |
static java.util.Date |
levelDate(java.util.Date date)
Levels the date so that only the day, month, and year are significant. |
static java.util.Date |
nextDay(java.util.Date date)
|
static java.util.Date |
nextMonth(java.util.Date date)
|
static java.util.Date |
nextWeek(java.util.Date date)
Returns a date one week later than the provided date |
static java.util.Date |
nextYear(java.util.Date date)
Returns a date one year later than the provided date |
static java.util.Date |
previousDay(java.util.Date date)
|
static java.util.Date |
previousMonth(java.util.Date date)
|
static java.util.Date |
previousYear(java.util.Date date)
Returns a date one year earlier than the provided date |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static java.lang.ref.WeakReference<java.util.Calendar> wGc
private static java.lang.ref.WeakReference<java.util.Calendar> wC
| Constructor Detail |
|---|
private DateUtils()
| Method Detail |
|---|
public static java.text.DateFormat getShortDateFormat()
public static java.util.Date levelDate(java.util.Date date)
public static boolean before(java.util.Date d1,
java.util.Date d2,
boolean inclusive)
public static boolean before(java.util.Date d1,
java.util.Date d2)
d1 - date 1d2 - date 2
public static boolean after(java.util.Date d1,
java.util.Date d2,
boolean inclusive)
public static boolean after(java.util.Date d1,
java.util.Date d2)
d1 - date 1d2 - date 2
public static java.util.Date lastDayOfMonth(int month,
int year)
month - The month (index starts at 0)year - The year (index starts at 1)
public static java.util.Date lastDayOfMonth(java.util.Date date)
date - the base date to work from
public static java.util.Date firstDayOfMonth(java.util.Date date)
date - the base date to work from
public static java.util.Date[] lastDaysOfMonth(int year)
year - The year to generate the array for
public static java.util.List<java.util.Date> lastDaysOfMonth(java.util.Date startDate,
java.util.Date endDate)
startDate - The date to start atendDate - The data to stop at
public static java.util.Date lastDayOfQuarter(java.util.Date bdate)
bdate - the base date to work from
public static java.util.Date lastDayOfYear(java.util.Date date)
date - the base date to work from
private static java.util.Date[] getQuarterBounds(java.util.Date date)
date - the base date to work from
public static int getQuarterNumber(java.util.Date date)
date - the base date to work from
private static java.util.GregorianCalendar getGCal()
private static java.util.Calendar getCal()
public static java.util.Date nextDay(java.util.Date date)
public static java.util.Date nextMonth(java.util.Date date)
public static java.util.Date previousMonth(java.util.Date date)
public static java.util.Date previousDay(java.util.Date date)
public static java.util.Date nextWeek(java.util.Date date)
public static java.util.Date nextYear(java.util.Date date)
public static java.util.Date previousYear(java.util.Date date)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||