Class DateField


  • public class DateField
    extends Field
    Represents a date field. The field may contain only date values which conform to a standard pattern, defined by DateField.FORMAT.
    • Field Detail

      • FORMAT

        public static final String FORMAT
        The date format used by date fields, compatible with SimpleDateFormat.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DateField

        public DateField​(String name)
        Creates a new DateField with the given name.
        Parameters:
        name - The unique name to associate with this field.
    • Method Detail

      • format

        public static String format​(Date date)
        Converts the given date into a string which follows the format used by date fields.
        Parameters:
        date - The date value to format, which may be null.
        Returns:
        The formatted date, or null if the provided time was null.
      • parse

        public static Date parse​(String dateString)
                          throws ParseException
        Parses the given string into a corresponding date. The string must follow the standard format used by date fields, as defined by FORMAT and as would be produced by format().
        Parameters:
        dateString - The date string to parse, which may be null.
        Returns:
        The date corresponding to the given date string, or null if the provided date string was null or blank.
        Throws:
        ParseException - If the given date string does not conform to the standard format used by date fields.