|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knowceans.util.TimeIntervals
public class TimeIntervals
TimeIntervals provides methods to find the time intervals (week, month, year) surrounding a given date. Intervals are expressed as 2-arrays of Date object, corresponding to the start and end times. By convention, intervals include their bounds.
FIXME: daylight saving time shift can create gaps in week and month intervals
| Constructor Summary | |
|---|---|
TimeIntervals()
|
|
| Method Summary | |
|---|---|
static java.util.Date[] |
awayExactDay(java.util.Date d,
int whatAway,
int howManyAway)
returns the start and end times of the field (Calendar.*) before / after the start of the day surrounding the date d, rounding the day. |
static java.util.Date[] |
awayExactDay(java.util.Date d,
int whatAway,
int howManyAway,
int howManyLong)
returns the start and end times of the field (Calendar.*) before / after the start of the day surrounding the date d. |
static java.util.Date[] |
dayOf(java.util.Date d)
returns the start and end times of the day surrounding the date d. |
static java.util.Date[] |
daysAway(java.util.Date d,
int away)
returns the start and end times of the day before / after the day given in date d. |
static boolean |
isIn(java.util.Date time,
java.util.Date[] interval)
check whether time is within the interval. |
static java.util.Date[] |
join(java.util.Date[] before,
java.util.Date[] after)
joins the limits of the two intervals by taking the start of before and the end of after. |
static void |
main(java.lang.String[] args)
|
static java.util.Date[] |
monthOf(java.util.Date d)
returns the start and end times of the month surrounding the date d. |
static java.util.Date[] |
monthsAway(java.util.Date d,
int away)
returns the start and end times of the months before / after the start of the month surrounding the date d. |
static java.util.Date[] |
weekOf(java.util.Date d)
returns the start and end times of the week surrounding the date d. |
static java.util.Date[] |
weeksAway(java.util.Date d,
int away)
returns the start and end times of the week before / after the start of the week surrounding the date d. |
static java.util.Date[] |
yearOf(java.util.Date d)
returns the start and end times of the year surrounding the date d. |
static java.util.Date[] |
yearsAway(java.util.Date d,
int away)
returns the start and end times of the years before / after the start of the year surrounding the date d. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TimeIntervals()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public static java.util.Date[] dayOf(java.util.Date d)
d -
public static java.util.Date[] weekOf(java.util.Date d)
d -
public static java.util.Date[] monthOf(java.util.Date d)
d -
public static java.util.Date[] yearOf(java.util.Date d)
d -
public static java.util.Date[] daysAway(java.util.Date d,
int away)
d - away -
public static java.util.Date[] weeksAway(java.util.Date d,
int away)
d - away -
public static java.util.Date[] monthsAway(java.util.Date d,
int away)
d - away -
public static java.util.Date[] yearsAway(java.util.Date d,
int away)
d - away -
public static java.util.Date[] awayExactDay(java.util.Date d,
int whatAway,
int howManyAway,
int howManyLong)
d - the date to start fromwhatAway - what time measure away (week, day, etc.)howManyAway - how many of the time measure awayhowManyLong - how many time measures as interval
public static java.util.Date[] awayExactDay(java.util.Date d,
int whatAway,
int howManyAway)
d - the date to start fromwhatAway - what time measure away (week, day, etc.)howManyAway - how many of the time measure away
public static boolean isIn(java.util.Date time,
java.util.Date[] interval)
time - interval -
public static java.util.Date[] join(java.util.Date[] before,
java.util.Date[] after)
before - after -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||