Class DateFormatManager


  • public class DateFormatManager
    extends java.lang.Object
    Date format manager. Utility class to help manage consistent date formatting and parsing. It may be advantageous to have multiple DateFormatManagers per application. For example, one for handling the output (formatting) of dates, and another one for handling the input (parsing) of dates.
    • Field Detail

      • _timeZone

        private java.util.TimeZone _timeZone
      • _locale

        private java.util.Locale _locale
      • _pattern

        private java.lang.String _pattern
      • _dateFormat

        private java.text.DateFormat _dateFormat
    • Constructor Detail

      • DateFormatManager

        public DateFormatManager()
      • DateFormatManager

        public DateFormatManager​(java.util.TimeZone timeZone)
      • DateFormatManager

        public DateFormatManager​(java.util.Locale locale)
      • DateFormatManager

        public DateFormatManager​(java.lang.String pattern)
      • DateFormatManager

        public DateFormatManager​(java.util.TimeZone timeZone,
                                 java.util.Locale locale)
      • DateFormatManager

        public DateFormatManager​(java.util.TimeZone timeZone,
                                 java.lang.String pattern)
      • DateFormatManager

        public DateFormatManager​(java.util.Locale locale,
                                 java.lang.String pattern)
      • DateFormatManager

        public DateFormatManager​(java.util.TimeZone timeZone,
                                 java.util.Locale locale,
                                 java.lang.String pattern)
    • Method Detail

      • getTimeZone

        public java.util.TimeZone getTimeZone()
      • setTimeZone

        public void setTimeZone​(java.util.TimeZone timeZone)
      • getLocale

        public java.util.Locale getLocale()
      • setLocale

        public void setLocale​(java.util.Locale locale)
      • getPattern

        public java.lang.String getPattern()
      • setPattern

        public void setPattern​(java.lang.String pattern)
        Set the pattern. i.e. "EEEEE, MMMMM d, yyyy hh:mm aaa"
      • getOutputFormat

        public java.lang.String getOutputFormat()
        Deprecated.
        Use getPattern().
        This method has been deprecated in favour of getPattern().
      • setOutputFormat

        public void setOutputFormat​(java.lang.String pattern)
        Deprecated.
        Use setPattern().
        This method has been deprecated in favour of setPattern().
      • getDateFormatInstance

        public java.text.DateFormat getDateFormatInstance()
      • setDateFormatInstance

        public void setDateFormatInstance​(java.text.DateFormat dateFormat)
      • format

        public java.lang.String format​(java.util.Date date)
      • format

        public java.lang.String format​(java.util.Date date,
                                       java.lang.String pattern)
      • parse

        public java.util.Date parse​(java.lang.String date)
                             throws java.text.ParseException
        Throws:
        java.text.ParseException
      • parse

        public java.util.Date parse​(java.lang.String date,
                                    java.lang.String pattern)
                             throws java.text.ParseException
        Throws:
        java.text.ParseException
      • configure

        private void configure()