A much simpler way of converting from a java.sql.Date to a java.util.Date is:
java.sql.Date sqlDate = .... java.util.Date utilDate = sqlDate; This will work, since java.util.Date is the parent class... However, I the original question wasn't so much how to convert an SQL to a UTIL (I think the subject line is incorrect), but rather how to simple display a date formatted on a JSP page. As others have pointed out, this can be easily accomplished using the bean:format or JSTL tags. (preferrably JSTL). There is no need to convert the sql.Date to a util.Date, since - as previously stated - util.Date is the parent. Hope this helps. - Nayan Hajratwala Chikli Consulting LLC http://www.chikli.com -----Original Message----- From: Raj Yadav [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 3:20 PM To: 'Struts Users Mailing List' Subject: RE: [OT] SQL Date to Util Date Tiago, This is what I have now. public static java.util.Date sqlToUtil(java.sql.Date date) { java.util.Date retDate = null; try { java.sql.Date incomingDate = date; String inDate = incomingDate.toString(); System.out.println("indate = " + inDate); //SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); DateFormat df = DateFormat.getDateInstance(); //new DateFormat(); retDate = df.parse(inDate); // = formatter.parse(inDate); //retDate = new java.util.Date(d.getTime()); //retDate = (java.sql.Date)formatter.parse(incomingDate); } catch(ParseException prsEx) { System.out.println("Parsing Exception in Utils = " + prsEx); } return retDate; } Both the SimpleDateFormat and DateFormat gives me back 2003-12-11. -raj -----Original Message----- From: Tiago Henrique Costa Rodrigues Alves [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 3:02 PM To: 'Struts Users Mailing List' Subject: RES: [OT] SQL Date to Util Date Take a look at the DateFormat class (J2sdk API) Tiago Henrique C. R. Alves Analista de Sistemas Politec - CSS Tel: 3038-6952 -----Mensagem original----- De: Raj Yadav [mailto:[EMAIL PROTECTED] Enviada em: sexta-feira, 12 de dezembro de 2003 16:59 Para: [EMAIL PROTECTED] Assunto: [OT] SQL Date to Util Date Hi All, I want to display date in a JSP page. It's coming from Oracle as java.sql.Date (2003-12-11) I want to put it in displayable format and put it in a JSP page. Something like 12/11/03. Someone please help me on this. Thanks, -raj --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

