// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ManualParse {
    private static Pattern re = Pattern.compile("(?:\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})([+-]\\d{4})");
    public static int parseOffset(String s) {
        Matcher m = re.matcher(s);
        if(m.find()) {
            String offset = m.group(1);
            return Integer.parseInt(offset.substring(0, 3)) * 60 + Integer.parseInt(offset.substring(3));
        } else {
            throw new IllegalArgumentException("No offset in string");
        }
    }
    public static void main(String[] args) {
        System.out.println(parseOffset("2009-06-26 14:13:00-0400"));
    }
}
