Here you can find the source of getPreviousDay(int year, int month, int day, int days)
public static int[] getPreviousDay(int year, int month, int day, int days)
//package com.java2s; import java.util.Calendar; public class Main { public static int[] getPreviousDay(int year, int month, int day, int days) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day); long longDate = (calendar.getTime()).getTime() - (1000 * 60 * 60 * 24 * days); java.util.Date date = new java.util.Date(longDate); calendar.setTime(date);//from w w w .j a va 2s .c o m int[] rtn = new int[3]; rtn[0] = calendar.get(Calendar.YEAR); rtn[1] = calendar.get(Calendar.MONTH) + 1; rtn[2] = calendar.get(Calendar.DATE); return rtn; } }