|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by Jeevanjosh in JDeveloper
I am getting a set values from the table by using the jsp and the Util.java
how can i get the values orderby date ? kindly help in solving the problem
thank you ,
attached my jsp, Util.java and the output
kindly help in solving this problem
thank you
regards
Joshline
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
|
My Util.java
public static int getCompareResult2(String date) throws ParseException {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
df.setLenient ( false );
DateFormat df1 = new SimpleDateFormat("EEE MMM dd kk:mm:ss zzz yyy", Locale.getDefault());
df1.setLenient ( false );
Date d1= df.parse(date);
Date now = df1.parse(new Date().toString());
Calendar today = Calendar.getInstance(Locale.getDefault());
today.setTime(now);
Calendar compare = Calendar.getInstance(Locale.getDefault());
compare.setTime(d1);
compare.set(Calendar.HOUR_OF_DAY, 0);
compare.set(Calendar.MINUTE, 0);
compare.set(Calendar.SECOND, 0);
compare.set(Calendar.MILLISECOND, 0);
today.set(Calendar.HOUR_OF_DAY, 0);
today.set(Calendar.MINUTE, 0);
today.set(Calendar.SECOND, 0);
today.set(Calendar.MILLISECOND, 0);
if (today.equals(compare)) {
return 0;
} else if(today.before(compare)) {
return -1;
} else {
return 1;
}
}
|
20091111-EE-VQP-92 / EE_QW_2_20070628