org.oddjob.schedules
Class CalendarUtils

java.lang.Object
  extended by org.oddjob.schedules.CalendarUtils

public class CalendarUtils
extends Object


Constructor Summary
CalendarUtils()
           
 
Method Summary
static Calendar dayOfMonth(Date referenceDate, int day, TimeZone timeZone)
          Utility function to get a calendar which represents the day of the month in which the reference date is.
static Calendar dayOfWeek(Date referenceDate, int day, TimeZone timeZone)
          Utility function to get a calendar which represents the day of the week from the reference date.
static Calendar dayOfYear(Date referenceDate, int dayOfYear, TimeZone timeZone)
          Calendar for the day of year.
static Calendar endOfMonth(Date inDate, TimeZone timeZone)
          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.
static Calendar endOfYear(Date referenceDate, TimeZone timeZone)
          Calcuate the date at the end of the year from the given 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.
static Calendar startOfMonth(Date inDate, TimeZone timeZone)
          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.
static Calendar startOfYear(Date referenceDate, TimeZone timeZone)
          Calculate the date at the start of the year for the given date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarUtils

public CalendarUtils()
Method Detail

setEndOfDay

public static void setEndOfDay(Calendar calendar)
Set the calendar to the end of day.

Parameters:
calendar - The calendar that will be set.

setEndOfMonth

public static void setEndOfMonth(Calendar calendar)
Set the calendar to the end of the month.

Parameters:
calendar - The calendar that will be set.

startOfMonth

public static Calendar startOfMonth(Date inDate,
                                    TimeZone timeZone)
Calculate the date at the start of the month for the given date.

Parameters:
inDate - The given date.
Returns:
The date at the start of the month.

endOfMonth

public static Calendar endOfMonth(Date inDate,
                                  TimeZone timeZone)
Calculate the date at the end of the month for the given date.

Parameters:
inDate - The given date.
Returns:
The calendar at the end of the month.

dayOfMonth

public static Calendar dayOfMonth(Date referenceDate,
                                  int day,
                                  TimeZone timeZone)
Utility function to get a calendar which represents the day of the month in which the reference date is.

Parameters:
referenceDate - The date to take month from.
day - The day.
Returns:
The Calendar.

startOfWeek

public static Calendar startOfWeek(Date inDate,
                                   TimeZone timeZone)
Calculate the start of the week for the given date.

Parameters:
inDate - The given date.
Returns:
The date at the start of the month.

endOfWeek

public static Calendar endOfWeek(Date inDate,
                                 TimeZone timeZone)
Calculate the start of the week for the given date.

Parameters:
inDate - The given date.
Returns:
The date at the start of the month.

dayOfWeek

public static Calendar dayOfWeek(Date referenceDate,
                                 int day,
                                 TimeZone timeZone)
Utility function to get a calendar which represents the day of the week from the reference date.

Parameters:
referenceDate - The date to take week from.
day - The day.
Returns:
The Calendar.

startOfYear

public static Calendar startOfYear(Date referenceDate,
                                   TimeZone timeZone)
Calculate the date at the start of the year for the given date.

Parameters:
referenceDate - The given date.
Returns:
The calendar at the start of the year.

endOfYear

public static Calendar endOfYear(Date referenceDate,
                                 TimeZone timeZone)
Calcuate the date at the end of the year from the given date.

Parameters:
referenceDate - The given date.
Returns:
The calendar at the end of the year.

dayOfYear

public static Calendar dayOfYear(Date referenceDate,
                                 int dayOfYear,
                                 TimeZone timeZone)
Calendar for the day of year.

Parameters:
referenceDate - The date to take year from.
dayOfYear - The day of the year.
Returns:
The calendar.

monthOfYear

public static Calendar monthOfYear(Date referenceDate,
                                   int month,
                                   TimeZone timeZone)
Utility function to get the start of the month as a Calendar.

Parameters:
referenceDate - The whole date.
month - The month to calculate the start of.
Returns:
The start of the month.