M
mail4sushovan
Hello Friends
In my program i am using the following codes:
Date today = new Date();
log.debug("today is"+today);
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-mm-dd");
String todayStr = fmt.format(today);
log.debug("todayStr value"+todayStr);
java.sql.Date dt = java.sql.Date.valueOf(new String(todayStr));
log.debug("current Dt is:"+dt);
The output iam getting is like this:
today is Sat Sep 09 19:20:13 IST 2006(from java.util.Date)
todayStr value 2006-20-09(from string value)
current Dt is: 2007-08-09(from java.sql.Date)
So how to avoid this.Please help me
Thank You in advance
sushovan
In my program i am using the following codes:
Date today = new Date();
log.debug("today is"+today);
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-mm-dd");
String todayStr = fmt.format(today);
log.debug("todayStr value"+todayStr);
java.sql.Date dt = java.sql.Date.valueOf(new String(todayStr));
log.debug("current Dt is:"+dt);
The output iam getting is like this:
today is Sat Sep 09 19:20:13 IST 2006(from java.util.Date)
todayStr value 2006-20-09(from string value)
current Dt is: 2007-08-09(from java.sql.Date)
So how to avoid this.Please help me
Thank You in advance
sushovan