public Date toDate(String iso8601string) throws ParseException {
  if (iso8601string == null) {
    return null;
  }
  DateFormat df=new SimpleDateFormat(ISO8601);
  df.setTimeZone(TimeZone.getTimeZone("UTC"));
  int z=iso8601string.indexOf('Z');
  if (z > 0) {
    iso8601string=iso8601string.substring(0,z) + "+0000";
  }
  try {
    Date date=df.parse(iso8601string);
    return date;
  }
 catch (  ParseException e) {
    DateFormat dfshort=new SimpleDateFormat(ISO8601short);
    dfshort.setTimeZone(TimeZone.getTimeZone("UTC"));
    try {
      return dfshort.parse(iso8601string);
    }
 catch (    ParseException ee) {
      DateFormat lastChance=new SimpleDateFormat(JavaDateToStringFormat);
      lastChance.setTimeZone(TimeZone.getTimeZone("UTC"));
      return lastChance.parse(iso8601string);
    }
  }
}

public Date toDate ( String iso8601string ) throws ParseException { if ( iso8601string == null ) { return null ; } DateFormat df = new SimpleDateFormat ( ISO8601 ) ; df . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; int z = iso8601string . indexOf ( 'Z' ) ; if ( z > 0 ) { iso8601string = iso8601string . substring ( 0 , z ) + "+0000" ; } try { Date date = df . parse ( iso8601string ) ; return date ; } catch ( ParseException e ) { DateFormat dfshort = new SimpleDateFormat ( ISO8601short ) ; dfshort . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; try { return dfshort . parse ( iso8601string ) ; } catch ( ParseException ee ) { DateFormat lastChance = new SimpleDateFormat ( JavaDateToStringFormat ) ; lastChance . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; return lastChance . parse ( iso8601string ) ; } } }
convert iso 8601 ( javascript ) string to date .
