• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pls help me Strring to Date

 
giribabu rosi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
basically
1.
presentation amgetting dd-MM-yyyy fornmat in jsp

2.in action i want to convert in to Date format

string date1 = "14-12-2004"
SimpleDateFormat dat1 = new SimpleDateFormat(dd-MM-yyyy);
java.sql.Date mDate = new java.sqlDate(dat1.parse(date1).getTime());


3.out put am getting 25-05-27(this is outfor .getTime())

4. getDate() in replce the getTime() it says Deprecated.

how do i solve these problems

in prepared Stmt have to insert

stmt.setDate(3,mDate);
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you tell us what does System.out.println(dat1.parse(date1)); prints.
Can you paste actual code here as Date.getTime is suppose to return a long value and by no means it can output in a format you specified.

Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic