Thursday, May 3, 2007

Re: [completeJava] Help on converting java.sql.Date(MS SQL Server) to java.util.Date---i am using Hibernate

Hey krian,
 
Find solution in attached java program.
 
-Naveen

Adimulam Kiran Kumar <friendz_kiran@yahoo.com> wrote:
Hi Sir,
 
I am not able to convert java.sql.Date to java.util.Date.
 
The date format i am getting from sql server is 2005-02-02 00:00:00.0. And i am getting this date from the sql server using Hibernate and not JDBC. If it would have using JDBC i would have got it using rs.getDate(col).
 
Please help me in this issue.
 
This is what i am trying...
     1) SimpleDateFormat sdf=new SimpleDateFormat("MM-dd-yyyy");
     2) date=new Date((String)row[12]);//I am getting date in row[12] as 2005-02-02 00:00:00.0
     3) System.out.println(sdf.format(date));
 
I am getting error on line 2,due to some parsing problems with the given date arguement.
 
Thanks,
Kiran
 
 


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.



______________________________________________________________________________________
"Though we cannot rewrite the past, we should write a better future"
M Naveen Kumar Reddy
+1 248-227-2293 (Edison, NJ)


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.

__._,_.___
Recent Activity
Visit Your Group
SPONSORED LINKS
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Yahoo! Groups

Start a group

in 3 easy steps.

Connect with others.

.

__,_._,___

No comments: