Here you can find the source of add(int field, long time, int val)
Parameter | Description |
---|---|
field | part of date |
time | given date |
val | value to add |
Calendar
containing resulting date
public static Calendar add(int field, long time, int val)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { /**/* ww w .jav a2 s. c om*/ * Useful routine to add given a number of units to specifed part of given time. * * @param field part of date * @param time given date * @param val value to add * * @return instance of <code>Calendar</code> containing resulting date */ public static Calendar add(int field, long time, int val) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); c.add(field, val); return c; } }