Difference between revisions of "DateUtils"

From GreenVulcano Wiki
Jump to: navigation, search
Line 708: Line 708:
  
 
     public static boolean isDayOfLegalToSolarChange(String date, String format)
 
     public static boolean isDayOfLegalToSolarChange(String date, String format)
    {
 
        return isDayOfLegalToSolarChange(DateUtils.stringToDate(date, format));
 
    }
 
  
 
     public static boolean encloseDayOfLegalToSolarChange(String date1, String format1, String date2, String format2)
 
     public static boolean encloseDayOfLegalToSolarChange(String date1, String format1, String date2, String format2)
    {
 
        return encloseDayOfLegalToSolarChange(stringToDate(date1, format1), stringToDate(date2, format2));
 
    }
 
  
 
     public static boolean encloseDayOfLegalToSolarChange(Date date1, Date date2)
 
     public static boolean encloseDayOfLegalToSolarChange(Date date1, Date date2)
    {
 
        Calendar d1 = createCalendar();
 
        d1.setTime(date1);
 
        Calendar d2 = createCalendar();
 
        d2.setTime(date2);
 
        return encloseDayOfLegalToSolarChange(d1, d2);
 
    }
 
  
 
     public static boolean encloseDayOfLegalToSolarChange(Calendar date1, Calendar date2)
 
     public static boolean encloseDayOfLegalToSolarChange(Calendar date1, Calendar date2)
    {
 
        Calendar lts1 = createCalendar();
 
        lts1.setTime(getDayOfLegalToSolarChange(date1.get(Calendar.YEAR)));
 
        Calendar lts2 = createCalendar();
 
        lts2.setTime(getDayOfLegalToSolarChange(date2.get(Calendar.YEAR)));
 
        return ((date1.before(lts1) || date1.equals(lts1)) && (lts1.equals(date2) || lts1.before(date2)))
 
                || ((date1.before(lts2) || date1.equals(lts2)) && (lts2.equals(date2) || lts2.before(date2)));
 
    }
 
  
 
     public static boolean encloseDayOfHourChange(String date1, String format1, String date2, String format2)
 
     public static boolean encloseDayOfHourChange(String date1, String format1, String date2, String format2)
    {
 
        return encloseDayOfHourChange(stringToDate(date1, format1), stringToDate(date2, format2));
 
    }
 
  
 
     public static boolean encloseDayOfHourChange(Date date1, Date date2)
 
     public static boolean encloseDayOfHourChange(Date date1, Date date2)
    {
 
        Calendar d1 = createCalendar();
 
        d1.setTime(date1);
 
        Calendar d2 = createCalendar();
 
        d2.setTime(date2);
 
        return encloseDayOfHourChange(d1, d2);
 
    }
 
  
 
     public static boolean encloseDayOfHourChange(Calendar date1, Calendar date2)
 
     public static boolean encloseDayOfHourChange(Calendar date1, Calendar date2)
Line 808: Line 777:
  
 
     private static synchronized boolean isEasterMonday(Calendar day)
 
     private static synchronized boolean isEasterMonday(Calendar day)
    {
 
        int nYear = day.get(Calendar.YEAR);
 
        if ((lastYear == -1) || (lastYear != nYear) || (dEasterMonday == null)) {
 
            dEasterMonday = getEasterSunday(nYear);
 
            dEasterMonday.add(Calendar.DAY_OF_MONTH, 1);
 
            lastYear = nYear;
 
        }
 
        if (dEasterMonday.equals(day)) {
 
            return true;
 
        }
 
        return false;
 
    }
 
  
 
     private static boolean isConfiguredAsHoliday(Calendar day) throws IllegalStateException
 
     private static boolean isConfiguredAsHoliday(Calendar day) throws IllegalStateException

Revision as of 15:31, 14 February 2012

Class FQN: it.greenvulcano.util.txt

Following the DateUtils public static methods

  • Parsing
 
DateUtils
    /**
     * Locale object is a representation of geographical, political, or cultural region. 
     * We can get and set our default locale through the java programs. 
     * This method returns the default locale the API uses when reporting errors.
    **/
    public static Locale getDefaultLocale()
    /**
     *  Gets the default timezone
    **/
    public static TimeZone getDefaultTimeZone()

    /**
     * Create a Calendar instance with default timezone.
     * 
     * @return
     **/
    public static Calendar createCalendar()

    /**
     * Convert a {@link java.lang.String} representation to a
     * {@link java.util.Date} instance.
     * 
     * @param date the string representation of Date/Time
     * @param format the conversion pattern
     * @return a Date instance
     */
    public static Date stringToDate(String date, String format)

    /**
     * Convert a {@link java.lang.String} representation to a
     * {@link java.util.Date} instance.
     * 
     * @param date the string representation of Date/Time
     * @param format the conversion pattern
     * @param tZone the TimeZone
     * @return a Date instance
     */
    public static Date stringToDate(String date, String format, String tZone)

    /**
     * Convert a {@link java.lang.String} representation to a
     * {@link java.util.Date} instance.
     * 
     * @param date the string representation of Date/Time
     * @param format the conversion pattern
     * @param tZone the TimeZone
     * @param lang the locale to be used in conversion
     * @return a Date instance
     */
    public static Date stringToDate(String date, String format, String tZone, String lang)
 

    /**
     * Convert a {@link java.util.Date} instance to a {@link java.lang.String}
     * representation.
     * 
     * @param date the Date instance to convert
     * @param format the conversion pattern
     * @return a string representation of date
     */
    public static String dateToString(Date date, String format)

    /**
     * Convert a {@link java.util.Date} instance to a {@link java.lang.String}
     * representation.
     * 
     * @param date the Date instance to convert
     * @param format the conversion pattern
     * @param tZone the TimeZone
     * @return a string representation of date
     */
    public static String dateToString(Date date, String format, String tZone)

    /**
     * Convert a {@link java.util.Date} instance to a {@link java.lang.String}
     * representation.
     * 
     * @param date the Date instance to convert
     * @param format the conversion pattern
     * @param tZone the TimeZone
     * @param lang the locale to be used in conversion
     * @return a string representation of date
     */
    public static String dateToString(Date date, String format, String tZone, String lang)



    /**
     * Convert a {@link java.lang.String} representation of date/Time to another
     * format. The output string representation is formatted according to
     * local timezone.
     * 
     * @param date the date/time representation to convert
     * @param formatIn the input date/time conversion pattern
     * @param formatOut the output date/time conversion pattern
     * @return the new string representation
     */
    public static String convertString(String date, String formatIn, String formatOut)


    /**
     * Convert a {@link java.lang.String} representation of date/Time to another
     * format. The output string representation is formatted according tolocal timezone.
     * 
     * @param date the date/time representation to convert
     * @param formatIn the input date/time conversion pattern
     * @param tZoneIn the input time zone
     * @param formatOut the output date/time conversion pattern
     * @param tZoneOut the output time zone
     * @return the new string representation
     */
    public static String convertString(String date, String formatIn, String tZoneIn, String formatOut, String tZoneOut)


    /**
     * Convert a {@link java.lang.String} representation of date/Time to another
     * format. The output string representation is formatted according to
     * local timezone.
     * 
     * @param date the date/time representation to convert
     * @param formatIn the input date/time conversion pattern
     * @param tZoneIn the input time zone
     * @param langIn the input locale to be used in conversion
     * @param formatOut the output date/time conversion pattern
     * @param tZoneOut the output time zone
     * @param langOut the output locale to be used in conversion
     * @return the new string representation
     */
    public static String convertString(String date, String formatIn, String tZoneIn, String langIn, String formatOut,
            String tZoneOut, String langOut)

    public static String convertDayHourString(String date, String formatIn, int hour, String formatOut, String tZoneOut)


    /**
     * Return a {@link java.lang.String} representation of the current date/time, according to local timezone.
     * 
     * @param format the date/time conversion pattern
     * @return the string representation of current date/time
     */
    public static String nowToString(String format)


    /**
     * Return a {@link java.lang.String} representation of the current date/time, according to tZone timezone.
     * 
     * @param format the date/time conversion pattern
     * @param tZone te destination timezone
     * @return the string representation of current date/time
     */
    public static String nowToString(String format, String tZone)


    /**
     * Return a {@link java.lang.String} representation of the current date/time, according to tZone timezone.
     * 
     * @param format the date/time conversion pattern
     * @param tZone te destination timezone
     * @param lang the locale to be used in conversion
     * @return the string representation of current date/time
     */
    public static String nowToString(String format, String tZone, String lang)

    /**
     * Return a {@link java.lang.String} representation, in teh given format, of tomorrow date.
     * 
     * @param format the required format.
     * @return a string representation of tomorrow.
     */
    public static String tomorrowToString(String format)


    /**
     * @return the tomorrow {@link java.util.Date} object
     */
    public static Date getTomorrow()


    /**
     * Compare two date/time represented as {@link java.lang.String} in the  given format.
     * 
     * @return -1 if date1 < date2, 0 if date1 = date2, 1 if date1 > date2
     */
    public static int compare(String date1, String format1, String date2, String format2)


    /**
     * Compare two date/time represented as {@link java.lang.String} in the  given format and {@link java.util.Date}.
     * 
     * @return -1 if date1 < date2, 0 if date1 = date2, 1 if date1 > date2
     */
    public static int compare(String date1, String format1, Date date2)



    /**
     * Return {@link java.util.Date} representing the first day of the week
     * containing date.
     * 
     * @param date the contained date
     * @return the first week day
     */
    public static Date getWeekStart(Date date)


    /**
     * Return {@link java.util.Date} representing the last day of the week
     * containing date.
     * 
     * @param date the contained date
     * @return the last week day
     */
    public static Date getWeekEnd(Date date)


    /**
     * Return {@link java.util.Date} representing the first day of the n't  week of year.
     * 
     * @param week the requested week
     * @param year the requested year
     * @return the first week day
     */
    public static Date getWeekStart(int week, int year)


    /**
     * Return {@link java.util.Date} representing the last day of the n't week of year.
     * 
     * @param week the requested week
     * @param year the requested year
     * @return the last week day
     */
    public static Date getWeekEnd(int week, int year)

    /**
     * Return {@link java.lang.String} representing the first day of the week containing datein the given format.
     * 
     * @param date the contained date
     * @param format the input/output date format
     * @return the first week day
     */
    public static String getWeekStart(String date, String format)
 
    /**
     * Return {@link java.lang.String} representing the last day of the week containing date in the given format.
     * 
     * @param date the contained date
     * @param format the input/output date format
     * @return the last week day
     */
    public static String getWeekEnd(String date, String format)

    /**
     * Return {@link java.lang.String} representing the first day of the n't week of year, in the given format.
     * 
     * @param week the requested week
     * @param year the requested year
     * @param format the output date format
     * @return the first week day
     */
    public static String getWeekStart(String week, String year, String format)


    /**
     * Return {@link java.lang.String} representing the last day of the n't week of year, in the given format.
     * 
     * @param week the requested week
     * @param year the requested year
     * @param format the output date format
     * @return the last week day
     */
    public static String getWeekEnd(String week, String year, String format)
 
    /**
     * Return {@link java.util.Date} representing the first day of the month containing date.
     * 
     * @param date the contained date
     * @return the first month day
     */
    public static Date getMonthStart(Date date)

    /**
     * Return {@link java.util.Date} representing the last day of the month containing date.
     * 
     * @param date the contained date
     * @return the last month day
     */
    public static Date getMonthEnd(Date date)
 

    /**
     * Return {@link java.lang.String} representing the first day of the month containing date in the given format.
     * 
     * @param date the contained date
     * @param format the input/output date format
     * @return the first month day
     */
    public static String getMonthStart(String date, String format)

    /**
     * Return {@link java.lang.String} representing the last day of the month containing date in the given format.
     * 
     * @param date the contained date
     * @param format the input/output date format
     * @return the last month day
     */
    public static String getMonthEnd(String date, String format)

    /**
     * Return {@link java.util.Date} representing the first day of the n't month of year.
     * 
     * @param month the requested month
     * @param year the requested year
     * @return the first month day
     */
    public static Date getMonthStart(int month, int year)


    /**
     * Return {@link java.util.Date} representing the last day of the n't month of year.
     * 
     * @param month the requested month
     * @param year the requested year
     * @return the last month day
     */
    public static Date getMonthEnd(int month, int year)

    /**
     * Return {@link java.lang.String} representing the first day of the n't month of year, in the given format.
     * 
     * @param month the requested month
     * @param year the requested year
     * @param format the output date format
     * @return the first month day
     */
    public static String getMonthStart(String month, String year, String format)

    /**
     * Return {@link java.lang.String} representing the last day of the n't month of year, in the given format.
     * 
     * @param month the requested month
     * @param year the requested year
     * @param format the output date format
     * @return the last month day
     */
    public static String getMonthEnd(String month, String year, String format)

    /**
     * Return {@link java.util.Date} representing the first day of the n't quarter of year.
     * 
     * @param quarter  the requested quarter
     * @param year the requested year
     * @return the first quarter day
     */
    public static Date getQuarterStart(int quarter, int year)


    /**
     * Return {@link java.util.Date} representing the last day of the n't quarter of year.
     * 
     * @param quarter the requested quarter
     * @param year the requested year
     * @return the last quarter day
     */
    public static Date getQuarterEnd(int quarter, int year)

    /**
     * Return {@link java.lang.String} representing the first day of the n't quarter of year, in the given format.
     * 
     * @param quarter the requested quarter
     * @param year he requested year
     * @param format the output date format
     * @return the first quarter day
     */
    public static String getQuarterStart(String quarter, String year, String format)

    /**
     * Return {@link java.lang.String} representing the last day of the n't
     * quarter of year, in the given format.
     * 
     * @param quarter the requested quarter
     * @param year the requested year
     * @param format the output date format
     * @return the last quarter day
     */
    public static String getQuarterEnd(String quarter, String year, String format)

    /**
     * Change the date/time represented as {@link java.lang.String} in the given format. The parameters type and value must be the same of {@link java.util.Calendar}.
     * 
     * @param date the date/time to change
     * @param format the date/time conversion pattern
     * @param type the field to change
     * @param value the field value
     * @return the modified date
     */
    public static Date setTime(String date, String format, int type, int value)

    /**
     * Change the date/time represented as {@link java.util.Date}. The parameters type and value must be the same of {@link java.util.Calendar}.
     * 
     * @param date the date/time to change
     * @param type the field to change
     * @param value the field value
     * @return the modified date
     */
    public static Date setTime(Date date, int type, int value)

    /**
     * Change the date/time represented as {@link java.lang.String} in the given
     * format. The parameters type and value must be
     * the same of {@link java.util.Calendar}.
     * 
     * @param date
     *        the date/time to change
     * @param format
     *        the date/time conversion pattern
     * @param type
     *        the field to change
     * @param value
     *        the offset value
     * @return the modified date
     */
    public static Date addTime(String date, String format, int type, int value)

    /**
     * Change the date/time represented as {@link java.lang.String} in the given
     * format. The parameters type and value must be
     * the same of {@link java.util.Calendar}.
     * 
     * @param date the date/time to change
     * @param format the date/time conversion pattern
     * @param type the field to change
     * @param value the offset value
     * @return the modified date
     */
    public static String addTime(String date, String format, String type, String value)

    /**
     * Change the date/time represented as {@link java.util.Date}. The
     * parameters type and value must be the same of
     * {@link java.util.Calendar}.
     * 
     * @param date the date/time to change
     * @param type the field to change
     * @param value the offset value
     * @return the modified date
     */
    public static Date addTime(Date date, int type, int value)

    /**
     * Change the current date/time. The parameters type and
     * value must be the same of {@link java.util.Calendar}.
     * 
     * @param type the field to change
     * @param value the offset value
     * @param onlyDate
     * if true the following fields are resetted: Calendar.HOUR_OF_DAY
     *        Calendar.MINUTE Calendar.SECOND Calendar.MILLISECOND
     * @return the modified date
     */
    public static Date addTime(int type, int value, boolean onlyDate)

    /**
     * Copy the following fields of the date/time date2 to
     * date1, represented as {@link java.util.Date}:
     * Calendar.DAY_OF_MONTH Calendar.MONTH Calendar.YEAR
     * 
     * @param date1 the date/time to change
     * @param date2 the source date/time
     * @return the modified date1
     */
    public static Date copyDate(Date date1, Date date2)

    /**
     * Copy the following fields of the date/time date2 to
     * date1, represented as {@link java.util.Calendar}:
     * Calendar.DAY_OF_MONTH Calendar.MONTH Calendar.YEAR
     * 
     * @param date1 the date/time to change
     * @param date2 the source date/time
     * @return the modified date1
     */
    public static Calendar copyDate(Calendar date1, Calendar date2)

    /**
     * Copy the following fields of the date/time date2 to
     * date1, represented as {@link java.util.Date}:
     * Calendar.HOUR_OF_DAY Calendar.MINUTE Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date1 the date/time to change
     * @param date2 the source date/time
     * @return the modified date1
     */
    public static Date copyTime(Date date1, Date date2)

    /**
     * Copy the following fields of the date/time date2 to
     * date1, represented as {@link java.util.Calendar}:
     * Calendar.HOUR_OF_DAY Calendar.MINUTE Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date1 the date/time to change
     * @param date2 the source date/time
     * @return the modified date1
     */
    public static Calendar copyTime(Calendar date1, Calendar date2)

    /**
     * Reset the following fields of the date/time represented as
     * {@link java.util.Date}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Date resetTime(Date date)

    /**
     * Reset the following fields of the date/time represented as
     * {@link java.util.Calendar}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Calendar resetTime(Calendar date)

    /**
     * Reset the following fields of the date/time represented as
     * {@link java.util.Date}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Date setStartOfDay(Date date)

    /**
     * Reset the following fields of the date/time represented as
     * {@link java.util.Calendar}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Calendar setStartOfDay(Calendar date)

    /**
     * Set to their maximum, the following fields of the date/time represented
     * as {@link java.util.Date}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Date setEndOfDay(Date date)

    /**
     * Set to their maximum, the following fields of the date/time represented
     * as {@link java.util.Calendar}: Calendar.HOUR_OF_DAY Calendar.MINUTE
     * Calendar.SECOND Calendar.MILLISECOND
     * 
     * @param date the date/time to change
     * @return the modified date
     */
    public static Calendar setEndOfDay(Calendar date)

    /**
     * Generate a range of days starting from date1 till
     * date2, represented as {@link java.lang.String} in the given
     * format.
     * 
     * @param date1 start date (inclusive)
     * @param format1 format of start date
     * @param date2 end date (inclusive)
     * @param format2 format of end date
     * @return an array of {@link java.util.Date}
     */
    public static Date[] generateRange(String date1, String format1, String date2, String format2)

    /**
     * Generate a range of days starting from date1 till
     * date2, represented as {@link java.util.Date}.
     * 
     * @param date1 start date (inclusive)
     * @param date2 end date (inclusive)
     * @return an array of {@link java.util.Date}
     */
    public static Date[] generateRange(Date date1, Date date2)


    /**
     * Generate a range of days starting from date1 tilldate2, represented as {@link java.util.Calendar}.
     * 
     * @param date1 start date (inclusive)
     * @param date2 end date (inclusive)
     * @return an array of {@link java.util.Date}
     */
    public static Date[] generateRange(Calendar date1, Calendar date2)

    /**
     * Return the days difference as date2 - date1, represented as {@link java.util.Date}.
     * 
     * @param date1
     * @param date2
     * @param tZone
     * @return the days difference
     */
    public static DateDiff getDiff(Date date1, Date date2, TimeZone tZone)

    /**
     * Return the days difference as date2 - date1, represented as {@link java.lang.String} in the given format.
     * 
     * @param date1
     * @param format1
     * @param date2
     * @param format2
     * @param tZone
     * @return the days difference
     */
    public static DateDiff getDiff(String date1, String format1, String date2, String format2, TimeZone tZone)

    /**
     * Return true if the given date is outside the daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDaySolar(Date date)

    /**
     * Return true if the given date, represented as {@link java.lang.String} in the given format,is outside the daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDaySolar(String data, String format)

    /**
     * Return true if the given date is in the daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDayLegal(Date data)

    /**
     * Return true if the given date, represented as {@link java.lang.String} in the given format, is in the daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDayLegal(String data, String format)

    /**
     * Return true if the given date is the transition day to/from daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDayOfHourChange(Date data)

    /**
     * Return true if the given date, represented as {@link java.lang.String} in the given format, is the transition day to/from daylight saving time.
     * 
     * @param date
     * @return
     */
    public static boolean isDayOfHourChange(String data, String format)

    /**
     * Return the transition day to daylight saving time for the current year.
     * 
     * @param date
     * @return
     */
    public static Date getDayOfSolarToLegalChange()

    /**
     * Return the transition day to daylight saving time for the given year.
     * 
     * @param date
     * @return
     */
    public static Date getDayOfSolarToLegalChange(int year)

    public static boolean isDayOfSolarToLegalChange(Date date)

    public static boolean isDayOfSolarToLegalChange(String date, String format)

    public static boolean encloseDayOfSolarToLegalChange(String date1, String format1, String date2, String format2)

    public static boolean encloseDayOfSolarToLegalChange(Date date1, Date date2)

    public static boolean encloseDayOfSolarToLegalChange(Calendar date1, Calendar date2)

    public static Date getDayOfLegalToSolarChange()

    public static Date getDayOfLegalToSolarChange(int year)

    public static boolean isDayOfLegalToSolarChange(Date date)

    public static boolean isDayOfLegalToSolarChange(String date, String format)

    public static boolean encloseDayOfLegalToSolarChange(String date1, String format1, String date2, String format2)

    public static boolean encloseDayOfLegalToSolarChange(Date date1, Date date2)

    public static boolean encloseDayOfLegalToSolarChange(Calendar date1, Calendar date2)

    public static boolean encloseDayOfHourChange(String date1, String format1, String date2, String format2)

    public static boolean encloseDayOfHourChange(Date date1, Date date2)

    public static boolean encloseDayOfHourChange(Calendar date1, Calendar date2)

    public static int numHoursInDay(Date date)

    public static int numHoursInDay(String date, String format)

    /**
     * Returns type of day: 1 = Feriale; 2 = Prefestivo; 4 = Festivo;
     * 
     * @param today
     * @return
     */
    public static int checkDay(Date day) throws IllegalStateException

    public static int checkDay(String data, String format)

    public static boolean checkDayType(int dayType, Date day) throws IllegalStateException



    /**
     * @return the haveEasterDay
     */
    public static boolean haveEasterDay()

    /**
     * Calculate Easter Sunday Written by Gregory N. Mirsky
     * Source: 2nd Edition by Peter Duffett-Smith.
     * It was originally from Butcher's Ecclesiastical Calendar, published in 1876.
     * This algorithm has also been published in the 1922 book General Astronomy by Spencer Jones in The Journal of the British Astronomical Association (Vol.88, page 91, December 1977) and in Astronomical Algorithms (1991) by Jean Meeus.
     * This algorithm holds for any year in the Gregorian Calendar, which (of course) means years including and after 1583.
     * 
     * <pre>
     * a=year%19
     * b=year/100
     * c=year%100
     * d=b/4 e=b%4
     * f=(b+8)/25
     * g=(b-f+1)/3
     * h=(19a+b-d-g+15)%30
     * i=c/4 k=c%4
     * l=(32+2e+2i-h-k)%7
     * m=(a+11h+22l)/451
     * Easter Month =(h+l-7m+114)/31 [3=March, 4=April]
     * p=(h+l-7m+114)%31
     * Easter Date=p+1 (date in Easter Month)
     * </pre>
     * 
     * Note: Integer truncation is already factored into the calculations. Using
     * higher
     * percision variables will cause inaccurate calculations.
     * 
     * @param nYear
     *        4 digit year
     */
    public static Calendar getEasterSunday(int nYear)

    private static synchronized boolean isEasterMonday(Calendar day)

    private static boolean isConfiguredAsHoliday(Calendar day) throws IllegalStateException

    /**
     * Return a DateFormat capable of handling the given conversion pattern. The formatters are cached after creation. By default, the formatters format dates according to the local timezone.
     * 
     * @param format to conversion pattern to handle
     * @return the requested DateFormat instance
     */
    private static synchronized DateFormat getFormatter(String format)

    /**
     * 
     *         DateFormat to handle FORMAT_SYSTEM_TIME
     */
    private static class SystemTimeDateFormat extends DateFormat

    /**
     * Return a DateFormat capable of handling the given conversion pattern for the tZone timezone.
     * 
     * @param format the conversion pattern to handle
     * @param tZone the timezone to handle
     * @return the requested DateFormat instance
     */
    private static synchronized DateFormat getFormatter(String tZone, String format)

    private static long toSystemTime(Object input)

    private static Calendar systemTimeToCalendar(String input)

    private static Date systemTimeToDate(String input)