Class DateConverter


  • public class DateConverter
    extends Object
    Date converter between database date formats and date objects
    Since:
    1.3.0
    Author:
    osbornb
    • Constructor Detail

      • DateConverter

        public DateConverter​(String... formats)
        Constructor
        Parameters:
        formats - date formats
        Since:
        6.2.0
    • Method Detail

      • converter

        public static DateConverter converter​(GeoPackageDataType type)
        Get a date converter for the data type
        Parameters:
        type - data type
        Returns:
        date converter
      • dateConverter

        public static DateConverter dateConverter()
        Get a date converter
        Returns:
        date converter
      • dateTimeConverter

        public static DateConverter dateTimeConverter()
        Get a date time converter
        Returns:
        date converter
      • dateConverter

        public static DateConverter dateConverter​(String... formats)
        Get a date converter for the provided formats
        Parameters:
        formats - formats
        Returns:
        date converter
      • addFormat

        public void addFormat​(String format)
        Add date format
        Parameters:
        format - date format
        Since:
        6.2.0
      • isExpected

        public boolean isExpected()
        Is a parsed date value always expected
        Returns:
        true if always expected
        Since:
        6.2.0
      • setExpected

        public void setExpected​(boolean expected)
        Set if a parsed date value is always expected
        Parameters:
        expected - true if always expected
        Since:
        6.2.0
      • stringValue

        public String stringValue​(Date date)
        Get the formatted string date value of the date
        Parameters:
        date - date
        Returns:
        formatted string date
      • dateValue

        public Date dateValue​(String date)
        Get the date value of the formatted string date
        Parameters:
        date - formatted string date
        Returns:
        date
      • isFunction

        public static boolean isFunction​(String value)
        Determine if the date/time string value is a SQLite function
        Parameters:
        value - date/time string value
        Returns:
        true if a function, false if the value should be parsed
        Since:
        3.3.0