Android examples for java.util:Week
get Week Ago Date From Today
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy-MM-dd"); public static String getWeekAgoDateFromToday() { long time_aweekago = System.currentTimeMillis() - 7L * 24 * 60 * 60 * 1000; Date d = new Date(time_aweekago); return yearFormat.format(d); }/*from ww w .java 2 s.c o m*/ }