Discussions

EJB programming & troubleshooting: java.util.Date and java.sql.Date

  1. java.util.Date and java.sql.Date (1 messages)

    Friends
    what is the difference between java.util.Date and java.sql.Date?
    Please
    thanks
    Selvaraj
  2. java.util.Date and java.sql.Date[ Go to top ]

    SQL date handle transformations of date to string values and string to date values conforming to SQL representations.
    SQL date overrides the toString() method and provides a static method( valueOf( String ))
    // From java.sql.Date class extending java.util.Date
     int i = super.getYear() + 1900;
     for 2005 getYears() returnd 105 in util date
     int j = super.getMonth() + 1;

    The format for all these string manipulations are done accoring to SQL standard which can never be changed by the programmer