I am working on dates in java. The real task is to search the data in between two dates from oracle database. I took the default date format of java using SimpleDateFormat as dd-MMM-yyyy
( the date appears in same format in oracle 10g xe) but when I run the project in netbeans, the date converts to YYYY-MM-DD
( I printed the date in console). This became issue for me to do searching, Can any on suggest me solution for this? .I also pasted my code below here
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
java.util.Date from_date2 = (Date)sdf.parse(from_date1);
java.sql.Timestamp ts1 = new java.sql.Timestamp(from_date2.getTime());
String from_date = ts1.toString();
System.out.println(ts1.toString());
java.util.Date to_date2 = sdf.parse(to_date1);
java.sql.Timestamp ts2 = new java.sql.Timestamp(to_date2.getTime());
System.out.println(ts2.toString());
String to_date = ts2.toString();