Java Calendar Calculate addTime(int calendarType, long time, int number)

Here you can find the source of addTime(int calendarType, long time, int number)

Description

add Time

License

Open Source License

Declaration

public static long addTime(int calendarType, long time, int number) 

Method Source Code

//package com.java2s;
/**/*from w ww.  jav a  2  s  .co m*/
 * Copyright (c) 2014 Xiufeng Liu ( xiufeng.liu@uwaterloo.ca )
 * <p/>
 * This file is free software: you may copy, redistribute and/or modify it
 * under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 * <p/>
 * This file is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * <p/>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses.
 */

import java.util.*;

public class Main {
    public static long addTime(int calendarType, long time, int number) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(time);
        cal.add(calendarType, number);
        return cal.getTimeInMillis();
    }
}

Related

  1. addQuarter(Calendar calendar, int quarterDelta)
  2. alignHours(int interval, Calendar timestamp)
  3. alignSecond(Calendar timestamp)
  4. cal2Str(Calendar pCal)
  5. calcAge(Calendar dateOfBirth, Calendar now)