悠然哈哈哈

导航

Java 获取最近时间

public static String getStatetime() throws ParseException{

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, - 7);
Date monday = c.getTime();
String preMonday = sdf.format(monday);
return preMonday;
}

 

来自:http://blog.sina.com.cn/s/blog_48fd85de0100gphn.html

posted on 2016-03-11 14:10  悠然886  阅读(408)  评论(0编辑  收藏  举报