@Test
public void Tes1(){
String [] arr = new String[7];
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = null;
for (int i=0;i<7;i++){
c=Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -i);
arr[6-i] =sdf.format(c.getTime());
}
for (int i = 0; i < arr.length; i++) {
System.err.println(arr[i]);
}
}
原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/tech/java/278178.html