Here you can find the source of getGMTHour(int localHour)
static int getGMTHour(int localHour)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008,2011 Peter Stibrany * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w. j a v a2 s . c om*/ * Peter Stibrany (pstibrany@gmail.com) - initial API and implementation *******************************************************************************/ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { static int getGMTHour(int localHour) { Calendar c = Calendar.getInstance(); c.clear(); c.set(Calendar.HOUR_OF_DAY, localHour); Date t = c.getTime(); c = Calendar.getInstance(TimeZone.getTimeZone("UTC")); c.clear(); c.setTime(t); return c.get(Calendar.HOUR_OF_DAY); } }