标签:null instance get 时间 日期 mat form system 获取
public static String getYesterdayStr(){
String yesterday=null;
Calendar calendar = Calendar.getInstance();//此时获取的是系统当前时间
calendar.add(Calendar.DATE, -1); //得到前一天
yesterday= new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//System.out.println(yesterday);
return yesterday;
}
public static String getBeforeYesterdayStr(){
String beforeyesterday=null;
Calendar calendar = Calendar.getInstance();//此时获取的是系统当前时间
calendar.add(Calendar.DATE, -2);
beforeyesterday= new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//System.out.println(yesterday);
return beforeyesterday;
}
标签:null instance get 时间 日期 mat form system 获取
原文地址:http://www.cnblogs.com/wjunxia/p/6763399.html