import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class WeekBefore { public static void main(String[] args) { Calendar cl =Calendar.getInstance(); cl.setTime(new Date()); cl.add(Calendar.DAY_OF_MONTH, -7); SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String weekBefore =sdf.format(cl.getTime()); System.out.println("一周前时间:"+weekBefore); } }
本文出自 “猴子也疯狂” 博客,请务必保留此出处http://1251769215.blog.51cto.com/11633863/1783786
原文地址:http://1251769215.blog.51cto.com/11633863/1783786