public class CalendarUtils
extends java.lang.Object
Constructor and Description |
---|
CalendarUtils(java.util.Calendar baseCalendar)
Constructor base on an existing calendar.
|
CalendarUtils(java.util.Date inDate,
java.util.TimeZone timeZone)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.Calendar |
dayOfMonth(DayOfMonth dayOfMonth)
Utility function to get a calendar which
represents the day of the month in which the reference date is.
|
java.util.Calendar |
dayOfWeek(DayOfWeek dayOfWeek)
Utility function to get a calendar which
represents the day of the week from the reference date.
|
java.util.Calendar |
dayOfWeekInMonth(DayOfWeek dayOfWeek,
WeekOfMonth week) |
java.util.Calendar |
dayOfYear(int dayOfMonth,
int month)
Calendar for the day of year.
|
java.util.Calendar |
endOfDay()
Calculate start of the day after.
|
java.util.Calendar |
endOfMonth()
Calculate the date at the end of the month for the given date.
|
static java.util.Calendar |
endOfWeek(java.util.Date inDate,
java.util.TimeZone timeZone)
Calculate the start of the week for the given date.
|
java.util.Calendar |
endOfWeekOfMonth(WeekOfMonth week) |
static java.util.Calendar |
endOfYear(java.util.Date referenceDate,
java.util.TimeZone timeZone)
Calcuate the date at the end of the year from the
given date.
|
java.util.Calendar |
forDate(java.util.Date date)
Return a new calendar with the base calendar time zone
but a different date.
|
static java.util.Calendar |
monthOfYear(java.util.Date referenceDate,
int month,
java.util.TimeZone timeZone)
Utility function to get the start of the month as a Calendar.
|
static void |
setEndOfDay(java.util.Calendar calendar)
Set the calendar to the end of day.
|
static void |
setEndOfMonth(java.util.Calendar calendar)
Set the calendar to the end of the month.
|
java.util.Calendar |
startOfDay()
Calculate the start of day date time (i.e.
|
java.util.Calendar |
startOfMonth()
Calculate the date at the start of the month for the given date.
|
static java.util.Calendar |
startOfWeek(java.util.Date inDate,
java.util.TimeZone timeZone)
Calculate the start of the week for the given date.
|
java.util.Calendar |
startOfWeekOfMonth(WeekOfMonth week) |
static java.util.Calendar |
startOfYear(java.util.Date referenceDate,
java.util.TimeZone timeZone)
Calculate the date at the start of the year for the given date.
|
public CalendarUtils(java.util.Date inDate, java.util.TimeZone timeZone)
inDate
- The date to base functionality on.timeZone
- The timezone for the calendarpublic CalendarUtils(java.util.Calendar baseCalendar)
baseCalendar
- public java.util.Calendar forDate(java.util.Date date)
date
- The date.public java.util.Calendar startOfDay()
public java.util.Calendar endOfDay()
public static void setEndOfDay(java.util.Calendar calendar)
calendar
- The calendar that will be set.public static void setEndOfMonth(java.util.Calendar calendar)
calendar
- The calendar that will be set.public java.util.Calendar startOfMonth()
public java.util.Calendar endOfMonth()
public java.util.Calendar dayOfMonth(DayOfMonth dayOfMonth)
day
- The day.public java.util.Calendar startOfWeekOfMonth(WeekOfMonth week)
public java.util.Calendar endOfWeekOfMonth(WeekOfMonth week)
public java.util.Calendar dayOfWeekInMonth(DayOfWeek dayOfWeek, WeekOfMonth week)
public static java.util.Calendar startOfWeek(java.util.Date inDate, java.util.TimeZone timeZone)
inDate
- The given date.public static java.util.Calendar endOfWeek(java.util.Date inDate, java.util.TimeZone timeZone)
inDate
- The given date.public java.util.Calendar dayOfWeek(DayOfWeek dayOfWeek)
day
- The day.public static java.util.Calendar startOfYear(java.util.Date referenceDate, java.util.TimeZone timeZone)
referenceDate
- The given date.public static java.util.Calendar endOfYear(java.util.Date referenceDate, java.util.TimeZone timeZone)
referenceDate
- The given date.public java.util.Calendar dayOfYear(int dayOfMonth, int month)
referenceDate
- The date to take year from.dayOfYear
- The day of the year.public static java.util.Calendar monthOfYear(java.util.Date referenceDate, int month, java.util.TimeZone timeZone)
referenceDate
- The whole date.month
- The month to calculate the start of. 1 is January,
12 is December.