dcsimg
Previous day's date
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   krishnan_meenakshi
Posted On:   Tuesday, October 2, 2001 01:13 PM

How do we get previous day's date in Java. We can get today's date. Is there any method for getPreviousDate

Re: Previous day's date

Posted By:   AlessandroA_Garbagnati  
Posted On:   Tuesday, October 2, 2001 01:17 PM

Hi,

Not directly, but you can do it using the java.util.Calendar class:


public final Date getYesterday() {

  Calendar retVal = new GregorianCalendar();

  retVal.add(Calendar.DATE, -1);

  return retVal.getTime();

}

About | Sitemap | Contact