how to extract hours and minutes from date retrieved from database
807600May 23 2007 — edited May 24 2007hi all
i want to extract hours and minute from the date taken from the database. so i wrote following code
java.util.Date createddate; or java.sql.Date createddate;
createddate=rs1.getDate("CreatedDate");
Calendar cal = Calendar.getInstance();
cal.setTime(createddate);
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
month=month+1;
int day = cal.get(Calendar.DATE);
int hour = cal.get(Calendar.HOUR);
int min= cal.get(Calendar.MINUTE);
String result=month +" "+day+" "+year + " " hour ":"+min;
When i printed the above string "result"in JSP i got the following result
5 7 2007 0:0
i am able to get the month,year, date but i am not able to get the hours and minutes.It is showing me time and minutes as o and o. I had created the CreatedDate column as date datatype in oracle
can any body help me to solve this problem
Regards
andy