Enum DateFormats

    • Enum Constant Detail

      • DEFAULT_DATE_FORMATS

        public static final DateFormats DEFAULT_DATE_FORMATS
        Sound set of common DateFormat definitions with no special addressee.
      • DEFAULT_DATE_FORMATS_SHORT

        public static final DateFormats DEFAULT_DATE_FORMATS_SHORT
        Sound set of common short DateFormat definitions with no special addressee.
      • COOKIE_DATE_FORMATS

        public static final DateFormats COOKIE_DATE_FORMATS
        Set of DateFormat definitions commonly used by cookies.
    • Method Detail

      • values

        public static DateFormats[] values​()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DateFormats c : DateFormats.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DateFormats valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getDateFormats

        public DateTimeFormatter[] getDateFormats​()
        Gets the date formats.
        Returns:
        the date formats
      • toDate

        public Date toDate​(String aDateString)
                    throws DateTimeException
        Creates a date from the provided String using the date formats as retrieved by the getDateFormats() method. If one date format fails, then the next one is used to parse the date text.
        Parameters:
        aDateString - The date text to be converted to a Date instance.
        Returns:
        The Date instance as of the date text.
        Throws:
        DateTimeException - the date time exception