Java UTC TimeZone localToUTC(long local)

Here you can find the source of localToUTC(long local)

Description

Converts local time to UTC (GMT).

License

Open Source License

Parameter

Parameter Description
local local time.

Return

UTC time.

Declaration

public static long localToUTC(long local) 

Method Source Code

//package com.java2s;
// the terms of the GNU General Public License as published by the Free Software Foundation;

import java.util.TimeZone;

public class Main {
    /**/*from   ww w  . j  a  v a2 s. c o  m*/
     * Converts local time to UTC (GMT).
     *
     * @param local local time.
     *
     * @return UTC time.
     */
    public static long localToUTC(long local) {
        int offset = TimeZone.getDefault().getRawOffset();
        return local - offset;
    }
}

Related

  1. _getUTCOffset()
  2. formatTimezoneOffsetFromUTC(TimeZone tz)
  3. getUTCTimeZone()
  4. getUTCTimeZone()
  5. utc()
  6. UTCTimeZone()