* @return a newly created SimpleTimeZone with the given offset and
* no Daylight Savings Time, or null if the id cannot be parsed.
*/
public static TimeZone getCustomTimeZone(String id){
NumberFormat numberFormat = null;
String idUppercase = id.toUpperCase();
if (id.length() > kGMT_ID.length() &&
idUppercase.startsWith(kGMT_ID))
{
ParsePosition pos = new ParsePosition(kGMT_ID.length());
boolean negative = false;
long offset;
if (id.charAt(pos.getIndex()) == 0x002D /*'-'*/)
negative = true;
else if (id.charAt(pos.getIndex()) != 0x002B /*'+'*/)
return null;
pos.setIndex(pos.getIndex() + 1);
numberFormat = NumberFormat.getInstance();
numberFormat.setParseIntegerOnly(true);
// Look for either hh:mm, hhmm, or hh
int start = pos.getIndex();
Number n = numberFormat.parse(id, pos);
if (pos.getIndex() == start) {
return null;
}
offset = n.longValue();
if (pos.getIndex() < id.length() &&
id.charAt(pos.getIndex()) == 0x003A /*':'*/)
{
// hh:mm
offset *= 60;
pos.setIndex(pos.getIndex() + 1);
int oldPos = pos.getIndex();
n = numberFormat.parse(id, pos);
if (pos.getIndex() == oldPos) {
return null;
}
offset += n.longValue();
}