Here you can find the source of lastDays(int count)
public static List<String> lastDays(int count)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { public static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); public static List<String> lastDays(int count) { List<String> strings = new ArrayList<String>(); Calendar day = Calendar.getInstance(); for (int i = 0; i < count; i++) { day.add(Calendar.DATE, -1); strings.add(df.format(day.getTime())); }/* ww w.ja v a 2 s. c o m*/ return strings; } }