This discussion is archived
1 Reply Latest reply: Apr 18, 2013 12:09 AM by PhHein RSS

How to retrieve date from oracle database with java in dd.MM.yyyy format.

tanvir ahmed Newbie
Currently Being Moderated
Sir,

I been able to get date from oracle database in the format like 2013-04-18 with the following code

String formatIn = "dd.MM.yyyy";
SimpleDateFormat sdfi = new SimpleDateFormat(formatIn);
java.util.Date utilDate = sdfi.parse(date.getText());
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());

final String dt[] = new String[1000];
try{
stm = db.con.createStatement();
rs = stm.executeQuery("select v_date from voucher_main order by v_id desc");
int a = 0;
while(rs.next()) {
dt[a] = rs.getDate("v_date").toString();
a++; }
}catch(SQLException sqlException){         
}

Now how can I get date in the format like 18.04.2013

Pls help.

Regards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points