Java get yesterday's date

code show as below:

The dateFormat new new = the SimpleDateFormat DateFormat ( "the MM-dd-YYYY");
Calendar Calendar Calendar.getInstance = ();
calendar.set (Calendar.HORE_OF_DAY, -24);
String yesterdayDate = dateFormat.format (calendar.getTime ());

Do not use Calendar_HORE, which is 12-hour, Calendar_HORE_OF_DAY is the 24-hour clock

Guess you like

Origin www.cnblogs.com/longgo/p/11528028.html