How to get previous days date in java. i.e. current date-1
I use the Calendar class as all familiar Date Constructor/methods are deprecated.
This backs up the calendar one day.
The Java 2 API docs are pretty good in showing how to use this class.
Hope this helped.
Senthil B Kumar
public class Prev
public static void main(String args)
Calendar xx = Calendar.getInstance();
Date dt = null;
dt = xx.getTime();
System.out.println("Yesterday Is : " + dt.getDate());
This thread has been viewed 984 times.
All times above are in ranch (not your local) time.
The current ranch time is
Dec 18, 2018 20:57:01.