Here you can find the source of getTimeZoneByOffSet(String offSetInString)
public static TimeZone getTimeZoneByOffSet(String offSetInString)
//package com.java2s; import java.util.*; public class Main { public static TimeZone getTimeZoneByOffSet(String offSetInString) { String timeZoneID = ""; Short offSetInShort = Short.parseShort(offSetInString); if (offSetInShort > 0) { timeZoneID = "GMT+" + offSetInShort; } else {/*from w ww . ja va 2 s .c o m*/ timeZoneID = "GMT" + offSetInShort; } return TimeZone.getTimeZone(timeZoneID); } public static TimeZone getTimeZoneByOffSet(short offSetInShort) { String timeZoneID = ""; if (offSetInShort > 0) { timeZoneID = "GMT+" + offSetInShort; } else { timeZoneID = "GMT" + offSetInShort; } return TimeZone.getTimeZone(timeZoneID); } }