获取当前时间的前一天 java

SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date=new Date();
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		calendar.add(Calendar.DAY_OF_MONTH, -1);
		date = calendar.getTime();
		System.out.println(sdf.format(date));

版权声明:本文为qq_39360632原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。