|
Oracle | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compoze.util.CalendarUtility
public class CalendarUtility
This class contains utility methods for manipulating calendars and related items.
Nested Class Summary | |
---|---|
static class |
CalendarUtility.IntStringPair
This class holds an integer key and a String value, and is used to return the results of enumerating the days and months. |
Constructor Summary | |
---|---|
CalendarUtility()
|
Method Summary | |
---|---|
static java.util.TimeZone[] |
getCommonTimeZones()
Gets a list of most common java timezones, these have an approximate mapping to the windows timezones. |
static java.lang.String |
getDayByNumber(int iDay)
Gets the localized string for a day. |
static java.lang.String |
getDayByNumber(int iDay,
int iFieldWidth)
Gets the localized string for a day. |
static java.lang.String |
getDayByNumber(int iDay,
int iFieldWidth,
java.util.Calendar cal,
java.util.Locale locale)
Gets the localized string for a day. |
static java.lang.String |
getDayByNumber(int iDay,
int iFieldWidth,
java.util.Locale locale)
Gets the localized string for a day. |
static java.lang.String |
getDayByNumber(int iDay,
java.util.Locale locale)
Gets the localized string for a day. |
static java.util.Collection |
getDays()
Returns a collection of IntStringPair objects representing the days. |
static java.util.Collection |
getDays(int iFieldWidth)
Returns a collection of IntStringPair objects representing the days. |
static java.util.Collection |
getDays(int iFieldWidth,
java.util.Calendar cal,
java.util.Locale locale)
Returns a collection of IntStringPair objects representing the days. |
static java.util.Collection |
getDays(int iFieldWidth,
java.util.Locale locale)
Returns a collection of IntStringPair objects representing the days. |
static java.util.Collection |
getDays(java.util.Locale locale)
Returns a collection of IntStringPair objects representing the days. |
static java.util.Date |
getFirstWorkDayOfWeek(java.util.Date givenDate)
Gets the first work day of the week the given date occurs during. |
static java.util.Date |
getFirstWorkDayOfWeek(java.util.Date givenDate,
java.util.Calendar cal)
Gets the first work day of the week the specified date occurs during. |
static java.util.Date |
getLastWorkDayOfWeek(java.util.Date givenDate)
Gets the last work day of the week the specified date occurs during. |
static java.util.Date |
getLastWorkDayOfWeek(java.util.Date givenDate,
java.util.Calendar cal)
Gets the last work day of the week the specified date occurs during. |
static java.lang.String |
getMonthByNumber(int iMonth)
Gets the localized string for a month. |
static java.lang.String |
getMonthByNumber(int iMonth,
int iFieldWidth)
Gets the localized string for a month. |
static java.lang.String |
getMonthByNumber(int iMonth,
int iFieldWidth,
java.util.Calendar cal,
java.util.Locale locale)
Gets the localized string for a month. |
static java.lang.String |
getMonthByNumber(int iMonth,
int iFieldWidth,
java.util.Locale locale)
Gets the localized string for a month. |
static java.lang.String |
getMonthByNumber(int iMonth,
java.util.Locale locale)
Gets the localized string for a month. |
static java.util.Collection |
getMonths()
Returns a collection of IntStringPair objects representing the months. |
static java.util.Collection |
getMonths(int iFieldWidth)
Returns a collection of IntStringPair objects representing the months. |
static java.util.Collection |
getMonths(int iFieldWidth,
java.util.Calendar cal,
java.util.Locale locale)
Returns a collection of IntStringPair objects representing the months. |
static java.util.Collection |
getMonths(int iFieldWidth,
java.util.Locale locale)
Returns a collection of IntStringPair objects representing the months. |
static java.util.Collection |
getMonths(java.util.Locale locale)
Returns a collection of IntStringPair objects representing the months. |
static void |
main(java.lang.String[] args)
Exerciser. |
static java.util.Date |
roundDate(java.util.Date date)
Rounds a date to the nearest midnight. |
static void |
setDefaultLocale(java.util.Locale locale)
Sets the default locale used for all calendar operations. |
static java.util.Date |
truncateDate(java.util.Date date,
int iField)
Truncates a date to the resolution of the given calendar field. |
static java.util.Date |
truncateDate(java.util.Date date,
int iField,
java.util.Calendar cal)
Truncates a date to the resolution of the given calendar field. |
static java.util.Date |
truncateDate(java.util.Date date,
int iField,
java.util.Locale locale)
Truncates a date to the resolution of the given calendar field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CalendarUtility()
Method Detail |
---|
public static void setDefaultLocale(java.util.Locale locale)
locale
- new default localepublic static java.util.TimeZone[] getCommonTimeZones()
public static java.lang.String getMonthByNumber(int iMonth)
iMonth
- month number (0=Jan)
public static java.lang.String getMonthByNumber(int iMonth, java.util.Locale locale)
iMonth
- month number (0=Jan)locale
- locale to use
public static java.lang.String getMonthByNumber(int iMonth, int iFieldWidth)
iMonth
- month number (0=Jan)iFieldWidth
- width of month field
public static java.lang.String getMonthByNumber(int iMonth, int iFieldWidth, java.util.Locale locale)
iMonth
- month number (0=Jan)iFieldWidth
- width of month fieldlocale
- locale to use
public static java.lang.String getMonthByNumber(int iMonth, int iFieldWidth, java.util.Calendar cal, java.util.Locale locale)
iMonth
- month number (0=Jan)iFieldWidth
- width of month fieldcal
- calendar to uselocale
- locale to use
public static java.lang.String getDayByNumber(int iDay)
iDay
- day number (1=Sunday)
public static java.lang.String getDayByNumber(int iDay, java.util.Locale locale)
iDay
- day number (1=Sunday)locale
- locale to use
public static java.lang.String getDayByNumber(int iDay, int iFieldWidth)
iDay
- day number (1=Sunday)iFieldWidth
- width of day field
public static java.lang.String getDayByNumber(int iDay, int iFieldWidth, java.util.Locale locale)
iDay
- day number (1=Sunday)iFieldWidth
- width of day fieldlocale
- locale to use
public static java.lang.String getDayByNumber(int iDay, int iFieldWidth, java.util.Calendar cal, java.util.Locale locale)
iDay
- day number (1=Sunday)iFieldWidth
- width of day fieldcal
- calendar to uselocale
- locale to use
public static java.util.Collection getMonths()
public static java.util.Collection getMonths(java.util.Locale locale)
locale
- the locale to use
public static java.util.Collection getMonths(int iFieldWidth)
iFieldWidth
- width of month field
public static java.util.Collection getMonths(int iFieldWidth, java.util.Locale locale)
iFieldWidth
- width of month fieldlocale
- the locale to use
public static java.util.Collection getMonths(int iFieldWidth, java.util.Calendar cal, java.util.Locale locale)
iFieldWidth
- width of month fieldcal
- the calendar to uselocale
- the locale to use
public static java.util.Collection getDays()
public static java.util.Collection getDays(java.util.Locale locale)
locale
- the locale to use
public static java.util.Collection getDays(int iFieldWidth)
iFieldWidth
- width of day field
public static java.util.Collection getDays(int iFieldWidth, java.util.Locale locale)
iFieldWidth
- width of day fieldlocale
- the locale to use
public static java.util.Collection getDays(int iFieldWidth, java.util.Calendar cal, java.util.Locale locale)
iFieldWidth
- width of day fieldlocale
- the locale to use
public static java.util.Date getFirstWorkDayOfWeek(java.util.Date givenDate)
givenDate
- the date
public static java.util.Date getFirstWorkDayOfWeek(java.util.Date givenDate, java.util.Calendar cal)
givenDate
- the datecal
- the calendar to use
public static java.util.Date getLastWorkDayOfWeek(java.util.Date givenDate)
givenDate
- the date
public static java.util.Date getLastWorkDayOfWeek(java.util.Date givenDate, java.util.Calendar cal)
givenDate
- the datecal
- the calendar to use
public static java.util.Date truncateDate(java.util.Date date, int iField)
date
- date to roundiField
- the calendar field (valid fields are
YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY,
MINUTE, SECOND, and MILLISECOND)- fields less
significant than this will be set to their
minimum value
Calendar
public static java.util.Date truncateDate(java.util.Date date, int iField, java.util.Locale locale)
date
- date to roundiField
- the calendar field (valid fields are
YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY,
MINUTE, SECOND, and MILLISECOND)- fields less
significant than this will be set to their
minimum valuelocale
- the locale to use
Calendar
public static java.util.Date truncateDate(java.util.Date date, int iField, java.util.Calendar cal)
date
- date to roundiField
- the calendar field (valid fields are
YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY,
MINUTE, SECOND, and MILLISECOND)- fields less
significant than this will be set to their
minimum valuecal
- the calendar to uselocale
- the locale to use
Calendar
public static java.util.Date roundDate(java.util.Date date)
date
- date to round
Calendar
public static void main(java.lang.String[] args)
args
- arguments (none taken)
|
Oracle | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |