Here you can find the source of localToUTC(long local)
Parameter | Description |
---|---|
local | local time. |
public static long localToUTC(long local)
//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; } }