code: public static Date toDate(String dateString) {
          if (dateString == null) return null;
          SimpleDateFormat dateFormat = new SimpleDateFormat();
          dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
          for (String format: ALLOWED_DATE_FORMATS) {
              dateFormat.applyPattern(format);
              try {
                  return dateFormat.parse(dateString);
              } catch (ParseException e) {
              }
          }
          return null;
      }
docs: Gets a UTC <code>Date</code> from a UTC ISO-8601 <code>String</code>.
  <p>
  The string should be in one of the {@link #ALLOWED_DATE_FORMATS},
  ideally {@link #PREFERRED_DATE_FORMAT} (e.g.
  <code>2011-01-16T08:27:01.002Z</code>).
  
  @param dateString the string to parse.
  @return the date if parsing was successful, or <code>null</code> if
  if dateString was given as null or parsing was unsuccessful
  for any other reason.