class DateUtils {

    public static Date stringToDate(String strDate) throws ParseException {
        int[] diffTime = null;
        boolean plusTime = true;

        // get time differences (if any)
        int idxT = strDate.indexOf('T');
        if (idxT == -1) {
            throw new ParseException("Invalid Date Format", 0);
        }

        int idxDiffUTC = strDate.indexOf('-', idxT);
        if (idxDiffUTC == -1) {
            idxDiffUTC = strDate.indexOf('+', idxT);
            plusTime = false;
        }

        if (idxDiffUTC != -1) {
            diffTime = getDiffTime(strDate, idxDiffUTC);
            strDate = strDate.substring(0, idxDiffUTC);
        }

        // remove the trailing z/Z character
        char lastChar = strDate.charAt(strDate.length() - 1);
        if ((lastChar == 'z') || (lastChar == 'Z')) {
            strDate = strDate.substring(0, strDate.length() - 1);
        }

        return createDate(strDate, diffTime, plusTime);
    }

}