Here you can find the source of getTimezoneTime(long time, int timezone)
public static long getTimezoneTime(long time, int timezone)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.TimeZone; public class Main { public static long getTimezoneTime(long time, int timezone) { Calendar calendar = getCalendar(time); int hour = calendar.get(Calendar.HOUR_OF_DAY); hour = (hour + timezone) % 24;/*from www .j a va 2 s . c om*/ if (hour < 0) { hour = 24 + hour; calendar.add(Calendar.DAY_OF_MONTH, -1); } calendar.set(Calendar.HOUR_OF_DAY, hour); return calendar.getTimeInMillis(); } public static Calendar getCalendar() { return Calendar.getInstance(TimeZone.getTimeZone("UTC")); } public static Calendar getCalendar(long time) { Calendar calendar = getCalendar(); calendar.setTimeInMillis(time); return calendar; } }