private boolean validSamlDateFormat(String samlDate) {
    if (samlDate == null) {
      return false;
    }
    int indexT = samlDate.indexOf("T");
    int indexZ = samlDate.indexOf("Z");
    if (indexT != 10 || indexZ != 19) {
      return false;
    }
    String dateString = samlDate.substring(0, indexT);
    String timeString = samlDate.substring(indexT + 1, indexZ);
    SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
    SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
    ParsePosition pos = new ParsePosition(0);
    Date parsedDate = dayFormat.parse(dateString, pos);
    pos = new ParsePosition(0);
    Date parsedTime = timeFormat.parse(timeString, pos);
    if (parsedDate == null || parsedTime == null) {
      return false;
    }
    return true;
  }