Hi,
I need to save the current day in my SQL Server (I need a type java.sql.Date).
The problem is that I need to save the date with the format "dd/MM/yyyy", otherwise I couldn't save it.
Is there any way of getting the current day of the type java.sql.Date (not the java.util.Date) with the format I need?
I have tried on several ways, but none of them works :-(. The last one I tried is:
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
java.sql.Date now = new java.sql.Date(new java.util.Date().getTime());
String dateNow = now.toString();
try{
java.sql.Date indate = new java.sql.Date(formatter.parse(dateNow).getTime());
}
catch(Exception e){}
Thanks in advance,
Mireia
Message was edited by: Mireia Romo