Class DateFormatter

    • Field Detail

      • format

        private final String format
    • Constructor Detail

      • DateFormatter

        public DateFormatter​(DateFormat dateFormat)
        Create a new date formatter.
        Parameters:
        dateFormat - The date format to use when formatting
      • DateFormatter

        public DateFormatter​(String format)
        Create a new date formatter.
        Parameters:
        format - The date format to use when formatting
        See Also:
        SimpleDateFormat
    • Method Detail

      • format

        public String format​(Date value)
        Description copied from interface: Formatter
        Format a value by converting it to a string.
        Specified by:
        format in interface Formatter<Date>
        Parameters:
        value - The value to format
        Returns:
        A formatted string
      • parseString

        public Date parseString​(String value)
        Description copied from interface: Formatter
        Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.
        Specified by:
        parseString in interface Formatter<Date>
        Parameters:
        value - The string to parse
        Returns:
        An object
      • getDateFormat

        public DateFormat getDateFormat()
        Get access to the underlying DateFormat object used for formatting and parsing dates.
        Since:
        2.8
      • toExcelValue

        public ExcelValue<Date> toExcelValue​(Date value)
        Description copied from interface: ExcelFormatter
        Convert and format the given value to an Excel value. If the value is null the implementation may return null to create an empty cell or it may return another non-null value.
        Specified by:
        toExcelValue in interface ExcelFormatter<Date,​Date>
        Since:
        3.15