Timestamp to UTC
import java.util.Calendar; import java.util.GregorianCalendar; class Main { public static long toUTC(long timestamp) { Calendar cal = Calendar.getInstance(); int offset = cal.getTimeZone().getOffset(timestamp); return timestamp + offset; } }