Hi to all, I'm having a buring problem
Following code snippet i got from here, I use to explain my problem.
1. Date d = new Date();
2. System.out.println(d);
3. Calendar cal = new GregorianCalendar();
4. cal.setTime(d);
5. cal.roll(Calendar.HOUR_OF_DAY, -1); // problem is here
6. d = cal.getTime();
7. System.out.println(d);
lets say, in line no 2 printed as "Wed Feb 21 19:23:58 IST 2007"
& line 6 printed "Wed Feb 21 18:26:15 IST 2007"
if i pass 20 instead of 1 in line no 5, I'm getting "Wed Feb 21 23:27:16 IST 2007"
This is not what i need, i should get something like "Wed Feb 20 ......"
How can i solve this???
Guys, I need your help!!!
Thanks in advance