Android Calendar Add add(int field, long time, int val)

Here you can find the source of add(int field, long time, int val)

Description

Useful routine to add given a number of units to specifed part of given time.

License

Apache License

Parameter

Parameter Description
field part of date
time given date
val value to add

Return

instance of Calendar containing resulting date

Declaration

public static Calendar add(int field, long time, int val) 

Method Source Code

//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;
    }
}

Related

  1. addDay(Calendar c, int days)
  2. addMonth(Calendar c, int months)
  3. after(Calendar c, long offset)
  4. afterNDays(Calendar c, int n)