Class TimeField


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

      • FORMAT

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

      • TimeField

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

      • parse

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

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