|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openxava.util.Dates
public class Dates
Utilities to working with dates (java.util.Date).
| Nested Class Summary | |
|---|---|
static class |
Dates.DateDistance
|
| Constructor Summary | |
|---|---|
Dates()
|
|
| Method Summary | |
|---|---|
static Dates.DateDistance |
addDateDistances(Dates.DateDistance dis1,
Dates.DateDistance dis2)
|
static java.util.Date |
cloneWith2359(java.util.Date date)
Returns a clone but with 23:59:59:999 for hours, minutes, seconds and milliseconds. |
static java.util.Date |
cloneWithoutTime(java.util.Date date)
Returns a clone but without hours, minutes, seconds and milliseconds. |
static java.util.Date |
create(int day,
int month,
int year)
With hour to 0. |
static java.util.Date |
createCurrent()
Current date without time. |
static Dates.DateDistance |
dateDistance(java.util.Date f1,
java.util.Date f2)
Difference of 2 dates in years, months and days. |
static Dates.DateDistance |
dateDistance(java.util.Date f1,
java.util.Date f2,
boolean includeStartDate)
Difference of 2 dates in years, months and days. |
static java.lang.String |
dateFormatForJSCalendar(java.util.Locale locale)
|
static int |
daysInterval(java.util.Date startDate,
java.util.Date endDate,
boolean includeStartDate)
Returns number of days between startDate and endDate |
static int |
getDay(java.util.Date date)
Returns the day of date. |
static int |
getMonth(java.util.Date date)
Returns the month (1 to 12) of date. |
static int |
getYear(java.util.Date date)
Returns the year (4 digits) of date. |
static boolean |
isDifferentDay(java.util.Date f1,
java.util.Date f2)
Compares if 2 dates are equals at day, month and year level, ignoring time in comparing. |
static java.util.Date |
removeTime(java.util.Date date)
Puts hours, minutes, seconds and milliseconds to zero. |
static void |
setDay(java.util.Date date,
int day)
Put the day to the date. |
static void |
setMonth(java.util.Date date,
int month)
Put the month (1 to 12) to the date. |
static void |
setYear(java.util.Date date,
int year)
Put the year to the date. |
static Dates.DateDistance |
subtractDateDistances(Dates.DateDistance dis1,
Dates.DateDistance dis2)
|
static java.sql.Date |
toSQL(java.util.Date date)
Creates a java.sql.Date from a java.util.Date. |
static java.lang.String |
toString(java.util.Date date)
String with date in short format according current locale. |
static java.util.Date |
withTime(java.util.Date date)
Creates a date with day, month and year of original, but with current time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Dates()
| Method Detail |
|---|
public static java.util.Date create(int day,
int month,
int year)
public static java.util.Date createCurrent()
public static int getDay(java.util.Date date)
If date is null return 0.
public static int getYear(java.util.Date date)
public static int getMonth(java.util.Date date)
If date is null returns 0.
public static void setDay(java.util.Date date,
int day)
If date is null it has no effect (but no exception is thrown)
public static void setMonth(java.util.Date date,
int month)
If date is null it has no effect (but no exception is thrown)
public static void setYear(java.util.Date date,
int year)
If date is null it has no effect (but no exception is thrown)
public static java.util.Date removeTime(java.util.Date date)
public static java.util.Date cloneWithoutTime(java.util.Date date)
public static java.util.Date cloneWith2359(java.util.Date date)
public static java.sql.Date toSQL(java.util.Date date)
date - If null returns nullpublic static java.lang.String toString(java.util.Date date)
Current locale is from Locales.getCurrent().
date - If null returns empty string
public static java.util.Date withTime(java.util.Date date)
date - It is not changed
public static boolean isDifferentDay(java.util.Date f1,
java.util.Date f2)
f1 - Can be nullf2 - Can be null
public static Dates.DateDistance dateDistance(java.util.Date f1,
java.util.Date f2,
boolean includeStartDate)
f1 - If null returns nullf2 - If null returns null
public static Dates.DateDistance dateDistance(java.util.Date f1,
java.util.Date f2)
f1 - If null returns nullf2 - If null returns null
public static Dates.DateDistance addDateDistances(Dates.DateDistance dis1,
Dates.DateDistance dis2)
public static Dates.DateDistance subtractDateDistances(Dates.DateDistance dis1,
Dates.DateDistance dis2)
public static java.lang.String dateFormatForJSCalendar(java.util.Locale locale)
public static int daysInterval(java.util.Date startDate,
java.util.Date endDate,
boolean includeStartDate)
java.util.Date - startDatejava.util.Date - endDateboolean - includeStartDate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||