public class DateTimeUtility
extends java.lang.Object
Constructor and Description |
---|
DateTimeUtility() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
addDays(java.util.Date date,
int plusDays)
Add a number of days to a date.
|
static ilog.views.gantt.IlvTimeInterval |
centerDuration(ilog.views.gantt.IlvTimeInterval ti,
ilog.views.gantt.IlvDuration dur)
Centers the time interval inside the duration
|
static int |
getMinutes(java.util.Date date)
Convenience method for extracting just the Minutes from a Date object
|
static java.util.Date |
roundMinutes(java.util.Date in,
int minuteBlock)
Rounds a Date to the nearest Minute block using default
RoundingMode of HALF_UP. |
static java.util.Date |
roundMinutes(java.util.Date in,
int minuteBlock,
java.math.RoundingMode roundingMode)
Rounds a Date to the nearest Minute block while accounting for the
RoundingMode . |
static java.util.Calendar |
trimToDay(java.util.Calendar calendar)
Trims a
Calendar date to the start of the day |
static java.util.Date |
trimToDay(java.util.Date in)
Trims a
Date to the start of the day |
public static java.util.Date roundMinutes(java.util.Date in, int minuteBlock)
RoundingMode
of HALF_UP.in
- Date
minuteBlock
- Minute block, 5, 10, 15, 20 or 30, 60public static java.util.Date roundMinutes(java.util.Date in, int minuteBlock, java.math.RoundingMode roundingMode)
RoundingMode
. HALF_UP means
that times that are exactly half of the minute block will be rounded up. HALF_DOWN means that times
that are exactly half of the minuteBlock will be rounded down. For example, if the minute block is 10 and the
time has 5 minutes, then the time will be rounded to 10 when HALF_UP and 0 when HALF_DOWN.in
- Date
minuteBlock
- Minute block, 5, 10, 15, 20 or 30, 60public static java.util.Date trimToDay(java.util.Date in)
Date
to the start of the dayin
- Date
Date
trimmed to the start of the daypublic static java.util.Calendar trimToDay(java.util.Calendar calendar)
Calendar
date to the start of the daycalendar
- datepublic static int getMinutes(java.util.Date date)
date
- Date objectpublic static ilog.views.gantt.IlvTimeInterval centerDuration(ilog.views.gantt.IlvTimeInterval ti, ilog.views.gantt.IlvDuration dur)
ti
- dur
- public static java.util.Date addDays(java.util.Date date, int plusDays)
date
- days
- to add