public class DateUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DateUtils.DateOperation
This class is used to store directives for Dates (or time) manipulation.
|
static interface |
DateUtils.IDateOperation
This class is used to describe directives for Dates (or time) manipulation,
i.e. adding year(s), month(s), day(s), hour(s), minute(s), second(s) or milli(s) to a provided date.
|
Modifier and Type | Field and Description |
---|---|
static long |
MILLIS_IN_SECOND |
static int |
MINUTES_IN_HOUR |
static int |
SECONDS_IN_MINUTE |
Modifier | Constructor and Description |
---|---|
protected |
DateUtils() |
Modifier and Type | Method and Description |
---|---|
long |
diff(Calendar d1,
Calendar d2,
char field) |
protected long |
diffInDay(Calendar d1,
Calendar d2) |
protected long |
diffInHour(Calendar d1,
Calendar d2) |
protected long |
diffInMilli(Calendar d1,
Calendar d2) |
protected long |
diffInMinute(Calendar d1,
Calendar d2) |
protected long |
diffInMonth(Calendar d1,
Calendar d2) |
protected long |
diffInSecond(Calendar d1,
Calendar d2) |
protected long |
diffInYear(Calendar d1,
Calendar d2) |
Calendar |
execute(Calendar c,
DateUtils.IDateOperation operation)
Handles operations on Calendar.
|
Date |
execute(Date d,
DateUtils.IDateOperation operation)
Handles operations on Date.
|
Date |
execute(Date d,
DateUtils.IDateOperation operation)
Handles operations on java.sql.Date.
|
Time |
execute(Time d,
DateUtils.IDateOperation operation)
Handles operations on java.sql.Time.
|
Timestamp |
execute(Timestamp d,
DateUtils.IDateOperation operation)
Handles operations on java.sql.Timestamp.
|
XMLGregorianCalendar |
execute(XMLGregorianCalendar c,
DateUtils.IDateOperation operation)
Handles operations on XMLGregorianCalendar.
|
static DateUtils |
getDefaultInstance()
Get default global instance.
|
protected <A extends Calendar> |
update(A c,
DateUtils.IDateOperation operation)
Updates the provided calendar, without creating a new instance.
|
public static final int MINUTES_IN_HOUR
public static final int SECONDS_IN_MINUTE
public static final long MILLIS_IN_SECOND
public static DateUtils getDefaultInstance()
public Calendar execute(Calendar c, DateUtils.IDateOperation operation)
c
- The input Calendar.operation
- The operation to perform.public XMLGregorianCalendar execute(XMLGregorianCalendar c, DateUtils.IDateOperation operation) throws UtilsException
c
- The input Calendar.operation
- The operation to perform.UtilsException
- If XMLGregorianCalendar could not be instantiatedpublic Date execute(Date d, DateUtils.IDateOperation operation)
d
- The input Date.operation
- The operation to perform.public Date execute(Date d, DateUtils.IDateOperation operation)
d
- The input java.sql.Date.operation
- The operation to perform.public Time execute(Time d, DateUtils.IDateOperation operation)
d
- The input java.sql.Time.operation
- The operation to perform.public Timestamp execute(Timestamp d, DateUtils.IDateOperation operation)
d
- The input java.sql.Timestamp.operation
- The operation to perform.protected <A extends Calendar> A update(A c, DateUtils.IDateOperation operation)