天天看点

打印输出昨天的当前时间

打印输出昨天的当前时间

package ForeverLover;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class DateSystem {

	/**
	 * @author ForeverLover
	 */
	public static void main(String[] args) {
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Calendar cal = Calendar.getInstance();
		cal.add(Calendar.DATE, -1);
		System.out.println(sdf.format(cal.getTime()));
		
	}

}
           

  

转载于:https://www.cnblogs.com/ForeverLover/p/4667854.html