I want to get the previous day (24 hours) from the current time.
e.g if current time is Date currentTime = new Date();
Date currentTime = new Date();
2011-04-25 12:
please checkout this here: Java Date vs Calendar
Calendar cal=Calendar.getInstance(); cal.setTime(date); //not sure if date.getTime() is needed here cal.add(Calendar.DAY_OF_MONTH, -1); Date newDate = cal.getTime();