From: Praveen S. <pra...@ho...> - 2003-07-21 16:11:08
|
Hi, When I setup rows in the MockMultiRowResultSet and try to retrieve it, the date is getting corrupted. The input is rows[0][0] = new java.sql.Date(2003, 7, 21); but I am getting the output as 3903-08-21 Thanks, Praveen ------------------------- import com.mockobjects.sql.*; public class ProxyDataBase { private static String dateFormat = new String("MM/dd/yyyy HH:mm:ss"); public static void main(String[] args) { try { MockMultiRowResultSet multiResultSet = new MockMultiRowResultSet(); Object[][] rows = new Object[1][3]; rows[0] = new Object[3]; rows[0][0] = new java.sql.Date(2003, 7, 21); rows[0][1] = new Double("1.2"); rows[0][2] = new String("String1"); multiResultSet.setupRows(rows); java.util.Date dt = null; while (multiResultSet.next()) { System.out.println(multiResultSet.getDate(1)); System.out.println(multiResultSet.getDouble(2)); System.out.println(multiResultSet.getString(3)); } } catch (Exception e) { e.printStackTrace(); } } } ------------------------- _________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |