public static long parseDateValue(String s,int start,int end){
  if (s.charAt(start) == '+') {
    start++;
  }
  int s1=s.indexOf('-',start + 1);
  int s2=s.indexOf('-',s1 + 1);
  if (s1 <= 0 || s2 <= s1) {
    throw new IllegalArgumentException(s);
  }
  int year=Integer.parseInt(s.substring(start,s1));
  int month=Integer.parseInt(s.substring(s1 + 1,s2));
  int day=Integer.parseInt(s.substring(s2 + 1,end));
  if (!isValidDate(year,month,day)) {
    throw new IllegalArgumentException(year + "-" + month+ "-"+ day);
  }
  return dateValue(year,month,day);
}

public static long parseDateValue ( String s , int start , int end ) { if ( s . charAt ( start ) == '+' ) { start ++ ; } int s1 = s . indexOf ( '-' , start + 1 ) ; int s2 = s . indexOf ( '-' , s1 + 1 ) ; if ( s1 <= 0 || s2 <= s1 ) { throw new IllegalArgumentException ( s ) ; } int year = Integer . parseInt ( s . substring ( start , s1 ) ) ; int month = Integer . parseInt ( s . substring ( s1 + 1 , s2 ) ) ; int day = Integer . parseInt ( s . substring ( s2 + 1 , end ) ) ; if ( ! isValidDate ( year , month , day ) ) { throw new IllegalArgumentException ( year + "-" + month + "-" + day ) ; } return dateValue ( year , month , day ) ; }
parse a date string . the format is : [ + | - ] year - month - day
