Hi There are two Date classes. java.util.Date and java.sql.Date. All I could see additional in sql.Date is the method valueOf(String s) which Converts a string in JDBC date escape format to a Date value. Rest all available in util.Date. Can some body give me an idea why sun is keeping sql.Date? (Just for one function?). Or I misunderstood? Also when to select which Date class? Thanks -Sainudheen [ October 08, 2003: Message edited by: Sainudheen Mydeen ]
java.sql.Date is newer than java.util.Date. The one sql-related function would be inappropriate to add to java.util.Date, and using a class from java.sql would be out of place in non-JDBC code, so having both classes is worthwhile. The java.sql version also restricts the range of available constructors.
Like java.util.Date, all three classes in the SQL package are thin wrappers around a numeric value representing a point in time. The Date and Time classes ignore the information regarding the time of day or the calendar date, respectively. The Timestamp class, however, not only includes the usual time and date information up to millisecond precision, but also allows storing additional data to accurately represent a point in time with nanosecond precision. (A nanosecond is a billionth of a second.)
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The thing to keep in mind with a java.sql.Date is that the hours, minutes, seconds, and milliseconds are set to 0. I believe this was't the case prior to JSDK 1.4, but it was fixed in order to comply with the SQL standard, where SQL Date values don't have time components. If you need finer granularity than that provided by java.sql.Date, use java.sql.TimeStamp. [ October 09, 2003: Message edited by: Jason Menard ]