GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE
Go To First  |  Previous Question  |  Next Question 
 J2EE  |  Question 22 of 104    Print  
difference between java.sql.Date and java.util.Date

  
Total Answers and Comments: 10 Last Update: July 09, 2009     Asked by: murthy 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 25, 2006 08:10:30   #1  
shashi Ranjan Kumar        

RE: difference between java.sql.Date and java.util.Dat...
The d/w java.util.date and java.sql is miner diffrence. The java.util.date is return the date with time and date and sql.date is return data with is retrive the data entry date i.e whitch time the data has enry or not.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
March 27, 2006 00:22:15   #2  
suresh        

RE: difference between java.sql.Date and java.util.Dat...
hi Rajan how r u ? your answer for the difference between java.util.Date & java.sql.Date is not understandable.so please give more information about that.thanking you suresh.
 
Is this answer useful? Yes | No
April 01, 2006 19:53:35   #3  
Kumaravel        

RE: difference between java.sql.Date and java.util.Dat...
java.sql.Date stores only date information not times. Simply converting a java.util.Date into a java.sql.Date will silently set the time to midnight.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
April 07, 2006 23:13:18   #4  
harshgupta Member Since: April 2006   Contribution: 2    

RE: difference between java.sql.Date and java.util.Dat...

Hi

1) java.util.Date is the superclass for java.sql.Date i.e public class Date extends java.util.Date { }

2) java.sql.Date is used for databases where we just need to store date and not time but java.util.date returns Date as well as time

3) java.util.Date has constructor with 0 parameters but java.sql.Date does not has the one so we canot use new Date() here time in milliseconds needs to be passed

Regards

(Harsh Gupta)


 
Is this answer useful? Yes | No
April 13, 2006 04:36:41   #5  
dillip kundu        

RE: difference between java.sql.Date and java.util.Dat...
Hi friends the answer is not clear enough.please send the correct data and maintain the uniquenees.if u don't know please don't answer.thanks!!
 
Is this answer useful? Yes | No
May 17, 2006 07:04:07   #6  
shelvammsc@yahoo.co.in Member Since: May 2006   Contribution: 2    

RE: difference between java.sql.Date and java.util.Dat...
Hi java.util.Date contains many methods.This class extends java.lang.object implements java.io.Serializable java.lang.Cloneable java.lang.Comparableit can contains both bean properties are also availablewhere as the java.sql.Date-------------- java.sql.Date extends java.util.Date {
 
Is this answer useful? Yes | No
May 21, 2006 02:44:41   #7  
Srinivas        

RE: difference between java.sql.Date and java.util.Dat...

Hi Friends

This is the main difference

java.util.date ---------->dd mm yyyy hh:mm:ss

java.sql.date----------->dd mm yyyy hh:mm:ss: ms

ok bye..........

Keeps Smiling And Mailing

bora_srinivasarao@yahoo.co.in

NOTE: If Any one have doubts Then send a mail to My mail id.and if any one want e-books java faq's and material send a mail to my id.


 
Is this answer useful? Yes | No
November 30, 2006 07:53:01   #8  
srinadh        

RE: difference between java.sql.Date and java.util.Dat...

Hi

This was exact output about java.util.Date and java.sql.Date:

java.util.Date date1 new java.util.Date();
System.out.println( Hello World! + date1);

java.sql.Date date2 new java.sql.Date(date1.getTime());
System.out.println( Hello World! + date2);

java.util.Date ----> here date1 object prints date and time.

java.sql.Date ----> here date2 object prints only date (2006-11-30)

Thanks

Srinadh


 
Is this answer useful? Yes | No
July 06, 2009 08:09:30   #9  
pravinsharma Member Since: October 2008   Contribution: 3    

RE: difference between java.sql.Date and java.util.Date
1. The java.sql.Date stores only day month and year.
2. The java.util.Date stores day month year along with time information upto milliseconds accuracy.

the sql versions are namely:
1. java.sql.Date - having only date information
2. java.sql.Time - having only time information
3. java.sql.TimeStamp - having date + time information with nanoseconds precision.

These are created as a wrapper for SQL DATE TIME TIMESTAMP datatypes which the java.util.Date is inefficient to handle.

 
Is this answer useful? Yes | No
July 09, 2009 02:51:28   #10  
vinodkashyap Member Since: July 2008   Contribution: 3    

RE: difference between java.sql.Date and java.util.Date
java.sql.Date - Used mainly while storing in the database
java.util.Date - Used to format the date

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape