Here you can find the source of getPreviousDate(String before)
Parameter | Description |
---|---|
before | the before |
public static Calendar getPreviousDate(String before)
//package com.java2s; import java.util.Calendar; public class Main { /**/*w w w . j av a 2s .c o m*/ * This method gets the past dates based on the no. of days passed. * * @param before * the before * @return the previous date */ public static Calendar getPreviousDate(String before) { int beforeInt = 0 - Integer.valueOf(before); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, beforeInt); return cal; } }