Java Calendar UTC subtractFromUTCMilliSeconds(int calendarTime, int actualValue)

Here you can find the source of subtractFromUTCMilliSeconds(int calendarTime, int actualValue)

Description

Subtract given minutes/hours/seconds to actual calendar time .

License

Open Source License

Parameter

Parameter Description
calendarTime the calendar time of hours/minutes/seconds
actualValue the value

Return

long

Declaration

public static long subtractFromUTCMilliSeconds(int calendarTime, int actualValue) 

Method Source Code

//package com.java2s;
/*//from   ww w .  j  a  va2s.c  o  m
 * DateUtil.java
 * Copyright (c) 2014, EcoFactor, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of EcoFactor
 * ("Confidential Information"). You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you entered into with
 * EcoFactor.
 */

import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    /**
     * Subtract given minutes/hours/seconds to actual calendar time .
     * @param calendarTime the calendar time of hours/minutes/seconds
     * @param actualValue the value
     * @return long
     */
    public static long subtractFromUTCMilliSeconds(int calendarTime, int actualValue) {

        final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        calendar.add(calendarTime, -actualValue);
        return calendar.getTimeInMillis();
    }
}

Related

  1. getUTCCalendar()
  2. getUTCCalendar(Date date)
  3. getUTCCalendarFromLocalDate(Date date)
  4. getUTCCalendarInstance()
  5. getUtcMillisFromEpoch(Calendar calendar)