private String toStringDate() {
    String retval;
    if ( value == null ) {
      return null;
    }

    SimpleDateFormat df = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss.SSS", Locale.US );

    if ( isNull() || value.getDate() == null ) {
      retval = Const.NULL_DATE;
    } else {
      retval = df.format( value.getDate() ).toString();
    }

    /*
     * This code was removed as TYPE_VALUE_DATE does not know "length", so this could never be called anyway else {
     * StringBuffer ret; if (isNull() || value.getDate()==null) ret=new StringBuffer(Const.NULL_DATE); else ret=new
     * StringBuffer(df.format(value.getDate()).toString()); Const.rightPad(ret, getLength()<=10?10:getLength());
     * retval=ret.toString(); }
     */
    return retval;
  }
@Test
  public void testToStringDate() {
    String result = null;

    Value vs1 = new Value( "Name", Value.VALUE_TYPE_DATE );
    result = vs1.toString( true );
    assertEquals( "", result );

    Value vs2 = new Value( "Name", Value.VALUE_TYPE_DATE );
    vs2.setNull( true );
    result = vs2.toString( true );
    assertEquals( "", result );

    SimpleDateFormat df = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss.SSS" );
    Date dt = df.parse( "2006/03/01 17:01:02.005", new ParsePosition( 0 ) );

    Value vs3 = new Value( "Name", Value.VALUE_TYPE_DATE );
    vs3.setValue( dt );
    result = vs3.toString( true );
    assertEquals( "2006/03/01 17:01:02.005", result );

    Value vs4 = new Value( "Name", Value.VALUE_TYPE_DATE );
    vs4.setNull( true );
    vs4.setLength( 2 );
    result = vs4.toString( true );
    assertEquals( "", result );

    Value vs5 = new Value( "Name", Value.VALUE_TYPE_DATE );
    vs3.setValue( dt );
    vs5.setLength( 10 );
    result = vs5.toString( true );
    assertEquals( "", result );
  }