Class DateTime

java.lang.Object
dev.visdb.seesaw.datasources.DateTime

public class DateTime extends Object
Utility class for Date/Time handling. Parsing/formatting SQL Date/Time/TimeStamp to/from text.
  • Method Details

    • isHandledDateTimeComp

      public static boolean isHandledDateTimeComp(RSC comp)
      Check if column is a handled; must be JDBC date/type and text component.
      Parameters:
      comp -
      Returns:
      true is OK
    • isHandledDateTimeJDBCType

      public static boolean isHandledDateTimeJDBCType(JDBCType jdbcType)
      Check if jdbcType is handled; must be JDBC date/type.
      Parameters:
      jdbcType -
      Returns:
      true is OK
    • dateTimeColumnValidate

      public static boolean dateTimeColumnValidate(String text, RSC comp)
      Check if the component is a valid date/time. To avoid exceptions, first use isHandledDateTimeComp(dev.visdb.seesaw.utils.SSComponentInterface).
      Parameters:
      text - The text to validate
      comp - The component that the text is derived from
      Returns:
    • getDateTimeParsers

      Get a list of parsers for date/time of the specified JDBCType. The first parser are typically used in order, the first success wins.
      Parameters:
      jdbcType -
      Returns:
      list of parser
    • getDateTimeFormatter

      Get formatter to produce date/time text for the specified JDBCType.
      Parameters:
      jdbcType -
      Returns:
      text formatter
    • getDateTimeObject

      public static Temporal getDateTimeObject(String text, RSC comp)
      Parse the specified text using this column's type's default parser, and return the corresponding java.time object; for example, LocalDate.
      Parameters:
      text - new text
      comp - target column
      Returns:
      a date/time object, null if can't parse
    • getSQLDateTimeObject

      public static Object getSQLDateTimeObject(String text, RSC comp)
      Parse the specified text using this column's type's default parser, and return the corresponding java.time object; for example, LocalDate.
      Parameters:
      text - new text
      comp - target column
      Returns:
      a date/time object, null if can't parse
    • getDateTimeText

      public static String getDateTimeText(RSC comp) throws SQLException
      Using the formatter for the column's specifiedJDBCType, format the column's specified value. Return empty string if column is null.
      Parameters:
      comp - target column
      Returns:
      text for column
      Throws:
      SQLException
    • getDateTimeText

      public static String getDateTimeText(Object jdbcDateTimeObject, RSC comp)
      Using the formatter for the column's specifiedJDBCType, format the column's specified value. Return empty string if column is null.
      Parameters:
      jdbcDateTimeObject - convert this to text
      comp - target column
      Returns:
      text for column