Here you can find the source of getPriorDay(int offset, String pattern)
public static String getPriorDay(int offset, String pattern)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getPriorDay(int offset, String pattern) { SimpleDateFormat timeFormat = new SimpleDateFormat(pattern); Calendar theday = Calendar.getInstance(); theday.add(5, offset);/*from w ww .ja v a2s. co m*/ return timeFormat.format(theday.getTime()); } }