Here you can find the source of getCalendar(Date date, int step)
public static Calendar getCalendar(Date date, int step)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Calendar getCalendar(Date date, int step) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from ww w.java 2s . c o m calendar.add(Calendar.DAY_OF_MONTH, step); return calendar; } public static Date add(Date _date, int _calendarField, int _amount) { if (_date == null) { return _date; } Calendar c = Calendar.getInstance(); c.setTime(_date); c.add(_calendarField, _amount); return c.getTime(); } }