Here you can find the source of getLocalHourMinute(BigDecimal gmtHour)
static int getLocalHourMinute(BigDecimal gmtHour)
//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 o m*/ * Peter Stibrany (pstibrany@gmail.com) - initial API and implementation *******************************************************************************/ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { static int getLocalHourMinute(BigDecimal gmtHour) { Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC")); c.clear(); int hour = gmtHour.intValue(); c.set(Calendar.HOUR_OF_DAY, hour); Date t = c.getTime(); c = Calendar.getInstance(); c.setTime(t); int localHour = c.get(Calendar.HOUR_OF_DAY); int minuteV = gmtHour.subtract(gmtHour.setScale(0, RoundingMode.FLOOR)).multiply(new BigDecimal("60")) .intValue(); return localHour * 100 + minuteV; } }