The IntervalDF constructors

The default constructor is defined as follows:
public IntervalDF() throws SQLException
Use this second version of the default constructor to display localized error messages if an exception is thrown:
public IntervalDF(Connection conn) throws SQLException
Use the following constructors to create intervals from specific input values:
  • Two time stamps t1 and t2, returning the IntervalDF value that equals t1 - t2:
    public IntervalDF(Timestamp t1, Timestamp t2) 
                          throws SQLException
    
    public IntervalDF(Timestamp t1, Timestamp t2, Connection conn) 
                          throws SQLException

    The second version allows you to support localized error messages.

  • A number of seconds and nanoseconds (large second values are converted to minutes, hours, or days):
    public IntervalDF(long seconds, long nanos) 
                          throws SQLException
    
    public IntervalDF(long seconds, long nanos, Connection conn) 
                          throws SQLException

    The second version allows you to support localized error messages.

  • A number of seconds, a number of nanoseconds, and qualifier:
    public IntervalDF(long seconds, long nanos, short qualifier) 
                          throws SQLException
    
    public IntervalDF(long seconds, long nanos, short qualifier, Connection conn) 
                          throws SQLException

    To specify the qualifier, you can use the getQualifier() method described in Interval methods. The second version allows you to support localized error messages.

  • A string:
    public IntervalDF(String string) 
                          throws SQLException
    public IntervalDF(String string, Connection conn) 
                          throws SQLException

    The second version allows you to support localized error messages.

    When you use these constructors, the default qualifier is set to the following values:

    leading field precision: 2 start code: TU_DAY end code: TU_F5

    For information about string INTERVAL formats, see the Informix® Guide to SQL: Syntax.

  • A string and a qualifier:
    public IntervalDF(String string, short qualifier)
                          throws SQLException
    
    public IntervalDF(String string, short qualifier, Connection conn) 
                          throws SQLException

    To specify the qualifier, you can use the getQualifier() method described in Interval methods. The second version allows you to support localized error messages.

  • A string and qualifier information:
    public IntervalDF(String string, int length, byte startcode, byte endcode) 
                            throws SQLException
    
    public IntervalDF(String string, int length, byte startcode,
    byte endcode, Connection conn) throws SQLException

    The second version allows you to support localized error messages.