org.oddjob.schedules
Class CalendarUtils

java.lang.Object
  extended byorg.oddjob.schedules.CalendarUtils

public class CalendarUtils
extends java.lang.Object


Constructor Summary
CalendarUtils()
           
 
Method Summary
static java.util.Calendar dayOfMonth(java.util.Date referenceDate, int day, java.util.TimeZone timeZone)
          Utility function to get a calendar which represents the day of the month in which the reference date is.
static java.util.Calendar dayOfWeek(java.util.Date referenceDate, int day, java.util.TimeZone timeZone)
          Utility function to get a calendar which represents the day of the week from the reference date.
static java.util.Calendar dayOfYear(java.util.Date referenceDate, int dayOfYear, java.util.TimeZone timeZone)
          Calendar for the day of year.
static java.util.Calendar endOfMonth(java.util.Date inDate, java.util.TimeZone timeZone)
          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.
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.
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.
static java.util.Calendar startOfMonth(java.util.Date inDate, java.util.TimeZone timeZone)
          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.
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.
 
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(java.util.Calendar calendar)
Set the calendar to the end of day.

Parameters:
calendar - The calendar that will be set.

setEndOfMonth

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

Parameters:
calendar - The calendar that will be set.

startOfMonth

public static java.util.Calendar startOfMonth(java.util.Date inDate,
                                              java.util.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 java.util.Calendar endOfMonth(java.util.Date inDate,
                                            java.util.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 java.util.Calendar dayOfMonth(java.util.Date referenceDate,
                                            int day,
                                            java.util.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 java.util.Calendar startOfWeek(java.util.Date inDate,
                                             java.util.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 java.util.Calendar endOfWeek(java.util.Date inDate,
                                           java.util.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 java.util.Calendar dayOfWeek(java.util.Date referenceDate,
                                           int day,
                                           java.util.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 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.

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

endOfYear

public 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.

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

dayOfYear

public static java.util.Calendar dayOfYear(java.util.Date referenceDate,
                                           int dayOfYear,
                                           java.util.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 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.

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