public synchronized static long parse(String string) { return new DateParser(string).parse(); }
public static long parse(String string) {  int year = -1; int month = -1; int day = -1; int hour = -1; int minute = -1; int second = -1; int timezone = 0; boolean localTimezone = true;   StringBuffer buf = new StringBuffer(); int parenNesting = 0; int len = string.length(); for (int i = 0;  i < len;  i++) { char ch = string.charAt(i); if (ch >= 'a' && ch <= 'z') ch -= 'a' - 'A'; if (ch == '(') parenNesting++; else if (parenNesting == 0) buf.append(ch); else if (ch == ')') parenNesting--; } int tmpMonth;    StringTokenizer strtok = new StringTokenizer(buf.toString(), " \t\n\r,");  while (strtok.hasMoreTokens()) { String tok = strtok.nextToken(); char firstch = tok.charAt(0); if ((firstch == '+' || firstch == '-') && year >= 0) { timezone = parseTz(tok, firstch); localTimezone = false; } else if (firstch >= '0' && firstch <= '9') { while (tok != null && tok.length() > 0) { int punctOffset = tok.length(); int num = 0; int punct; for (int i = 0;  ;  i++) { if (i >= punctOffset) { punct = -1; break; } else { punct = tok.charAt(i); if (punct >= '0' && punct <= '9') { if (num > 999999999) throw new IllegalArgumentException(tok); num = 10 * num + (punct - '0'); } else { punctOffset = i; break; } }  }  if (punct == ':') { if (hour < 0) hour = num; else minute = num; } else if ((num >= 70 && (punct == ' ' || punct == ',' || punct == '/' || punct < 0)) || (num < 70 && day >= 0 && month >= 0 && year < 0)) { if (num >= 100) year = num; else { int curYear = 1900 + new Date().getYear(); int firstYear = curYear - 80; year = firstYear / 100 * 100 + num; if (year < firstYear) year += 100; } } else if (punct == '/') { if (month < 0) month = num - 1; else day = num; } else if (hour >= 0 && minute < 0) minute = num; else if (minute >= 0 && second < 0) second = num; else if (day < 0) day = num; else throw new IllegalArgumentException(tok);   if (punct < 0 || punctOffset + 1 >= tok.length()) tok = null; else tok = tok.substring(punctOffset + 1); } } else if (firstch >= 'A' && firstch <= 'Z') { if (tok.equals("AM")) { if (hour < 1 || hour > 12) throw new IllegalArgumentException(tok); if (hour == 12) hour = 0; } else if (tok.equals("PM")) { if (hour < 1 || hour > 12) throw new IllegalArgumentException(tok); if (hour < 12) hour += 12; } else if (parseDayOfWeek(tok)) ; else if (tok.equals("UT") || tok.equals("UTC") || tok.equals("GMT")) localTimezone = false; else if (tok.startsWith("UT") || tok.startsWith("GMT")) { int signOffset = 3; if (tok.charAt(1) == 'T' && tok.charAt(2) != 'C') signOffset = 2;  char sign = tok.charAt(signOffset); if (sign != '+' && sign != '-') throw new IllegalArgumentException(tok);  timezone = parseTz(tok.substring(signOffset), sign); localTimezone = false; } else if ((tmpMonth = parseMonth(tok)) >= 0) month = tmpMonth; else if (tok.length() == 3 && tok.charAt(2) == 'T') {  char ch = tok.charAt(0); if (ch == 'E') timezone = -5 * 60; else if (ch == 'C') timezone = -6 * 60; else if (ch == 'M') timezone = -7 * 60; else if (ch == 'P') timezone = -8 * 60; else throw new IllegalArgumentException(tok);   if (tok.charAt(1) == 'D') timezone += 60; else if (tok.charAt(1) != 'S') throw new IllegalArgumentException(tok);  localTimezone = false; } else throw new IllegalArgumentException(tok); } else throw new IllegalArgumentException(tok); }   if (hour < 0) hour = 0; if (minute < 0) minute = 0; if (second < 0) second = 0;   if (year < 0 || month < 0 || day < 0) throw new IllegalArgumentException("Missing field");     GregorianCalendar cal = new GregorianCalendar(year, month, day, hour, minute, second); if (!localTimezone) { cal.set(Calendar.ZONE_OFFSET, timezone * 60 * 1000); cal.set(Calendar.DST_OFFSET, 0); } return cal.getTimeInMillis(); }
	public synchronized static long parse(String string) {		return new DateParser(string).parse();	}