Package adams.core

Class DateFormat

    • Constructor Detail

      • DateFormat

        public DateFormat()
        Initializes the formatter.
        See Also:
        DEFAULT_FORMAT
      • DateFormat

        public DateFormat​(String format)
        Initializes the formatter.
        Parameters:
        format - the format to use
        See Also:
        SimpleDateFormat(String)
    • Method Detail

      • getTechnicalInformation

        public TechnicalInformation getTechnicalInformation()
        Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
        Specified by:
        getTechnicalInformation in interface TechnicalInformationHandler
        Returns:
        the technical information about this class
      • setLenient

        public void setLenient​(boolean value)
        Sets whether parsing is to be lenient or not.
        Parameters:
        value - if true lenient parsing is used, otherwise not
        See Also:
        DateFormat.setLenient(boolean)
      • isLenient

        public boolean isLenient()
        Returns whether the parsing is lenient or not.
        Returns:
        true if parsing is lenient
        See Also:
        DateFormat.isLenient()
      • format

        public String format​(Date date)
        Returns the formatted string of the specified date object.
        Parameters:
        date - the date to format
        Returns:
        the generated string
        See Also:
        DateFormat.format(Date)
      • parse

        public Date parse​(String source)
        Tries to parse the given string and turns it into a date object. In contrast to SimpleDateFormat's parse(String) method, no exception is thrown here.
        Parameters:
        source - the string to parse
        Returns:
        the generated date object, or null in case of an error
        See Also:
        DateFormat.parse(String)
      • check

        public boolean check​(String source)
        Checks whether the string can be parsed. Does not throw an exception.
        Parameters:
        source - the string to parse
        Returns:
        true if string can be parsed
        See Also:
        DateFormat.parse(String)