Enum DateFormats

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.time.format.DateTimeFormatter[] getDateFormats()
      Gets the date formats.
      java.util.Date toDate​(java.lang.String aDateString)
      Creates a date from the provided String using the date formats as retrieved by the getDateFormats() method.
      static DateFormats valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DateFormats[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getDateFormats

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

        public java.util.Date toDate​(java.lang.String aDateString)
                              throws java.time.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:
        java.time.DateTimeException - the date time exception