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