@Test public void testConvertDateToTimestamp() throws Exception { ValueMetaTimestamp valueMetaTimestamp = new ValueMetaTimestamp(); Date date = new Date(); assertEquals( valueMetaTimestamp.convertDateToTimestamp( date ).getTime(), date.getTime() ); Timestamp timestamp = Timestamp.valueOf( "2014-04-05 04:03:02.123456789" ); Timestamp convertedTimestamp = valueMetaTimestamp.convertDateToTimestamp( timestamp ); assertEquals( convertedTimestamp.getTime(), timestamp.getTime() ); assertEquals( convertedTimestamp.getNanos(), timestamp.getNanos() ); }
public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException { if ( date == null ) { return null; } Timestamp result = null; if ( date instanceof Timestamp ) { result = (Timestamp) date; } else { result = new Timestamp( date.getTime() ); } return result; }
ValueMetaTimestamp extends ValueMetaDate { public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException { if ( date == null ) { return null; } Timestamp result = null; if ( date instanceof Timestamp ) { result = (Timestamp) date; } else { result = new Timestamp( date.getTime() ); } return result; } }
ValueMetaTimestamp extends ValueMetaDate { public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException { if ( date == null ) { return null; } Timestamp result = null; if ( date instanceof Timestamp ) { result = (Timestamp) date; } else { result = new Timestamp( date.getTime() ); } return result; } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); }
ValueMetaTimestamp extends ValueMetaDate { public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException { if ( date == null ) { return null; } Timestamp result = null; if ( date instanceof Timestamp ) { result = (Timestamp) date; } else { result = new Timestamp( date.getTime() ); } return result; } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); @Override boolean isDate(); @Override Date getDate( Object object ); @Override Long getInteger( Object object ); @Override Double getNumber( Object object ); @Override BigDecimal getBigNumber( Object object ); @Override Boolean getBoolean( Object object ); @Override String getString( Object object ); Timestamp getTimestamp( Object object ); int compare( Object data1, Object data2 ); @Override Object convertDataFromString( String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull,
      int trim_type ); Timestamp convertDateToTimestamp( Date date ); @Override Object convertData( ValueMetaInterface meta2, Object data2 ); @Override Object cloneValueData( Object object ); @Override ValueMetaInterface getValueFromSQLType( DatabaseMeta databaseMeta, String name, ResultSetMetaData rm,
      int index, boolean ignoreLength, boolean lazyConversion ); @Override Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ); @Override void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index,
      Object data ); @Override Object convertDataUsingConversionMetaData( Object data2 ); @Override byte[] getBinaryString( Object object ); @Override void writeData( DataOutputStream outputStream, Object object ); @Override Object readData( DataInputStream inputStream ); @Override synchronized SimpleDateFormat getDateFormat(); @Override String getFormatMask(); @Override Class<?> getNativeDataTypeClass(); }
ValueMetaTimestamp extends ValueMetaDate { public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException { if ( date == null ) { return null; } Timestamp result = null; if ( date instanceof Timestamp ) { result = (Timestamp) date; } else { result = new Timestamp( date.getTime() ); } return result; } ValueMetaTimestamp();  ValueMetaTimestamp( String name ); @Override boolean isDate(); @Override Date getDate( Object object ); @Override Long getInteger( Object object ); @Override Double getNumber( Object object ); @Override BigDecimal getBigNumber( Object object ); @Override Boolean getBoolean( Object object ); @Override String getString( Object object ); Timestamp getTimestamp( Object object ); int compare( Object data1, Object data2 ); @Override Object convertDataFromString( String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull,
      int trim_type ); Timestamp convertDateToTimestamp( Date date ); @Override Object convertData( ValueMetaInterface meta2, Object data2 ); @Override Object cloneValueData( Object object ); @Override ValueMetaInterface getValueFromSQLType( DatabaseMeta databaseMeta, String name, ResultSetMetaData rm,
      int index, boolean ignoreLength, boolean lazyConversion ); @Override Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ); @Override void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index,
      Object data ); @Override Object convertDataUsingConversionMetaData( Object data2 ); @Override byte[] getBinaryString( Object object ); @Override void writeData( DataOutputStream outputStream, Object object ); @Override Object readData( DataInputStream inputStream ); @Override synchronized SimpleDateFormat getDateFormat(); @Override String getFormatMask(); @Override Class<?> getNativeDataTypeClass();  }