@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]); } }