code: public static DateTimeComponents parse(String dateString, Boolean hasTime) {
  		Matcher m = regex.matcher(dateString);
  		if (!m.find()) {
  			throw Messages.INSTANCE.getIllegalArgumentException(19, dateString);
  		}
  
  		int i = 1;
  		int year = Integer.parseInt(m.group(i++));
  		int month = Integer.parseInt(m.group(i++));
  		int date = Integer.parseInt(m.group(i++));
  
  		i++; //skip
  
  		String hourStr = m.group(i++);
  		if (hasTime == null) {
  			hasTime = (hourStr != null);
  		}
  		if (!hasTime) {
  			return new DateTimeComponents(year, month, date);
  		}
  
  		int hour = (hourStr == null) ? 0 : Integer.parseInt(hourStr);
  
  		String minuteStr = m.group(i++);
  		int minute = (minuteStr == null) ? 0 : Integer.parseInt(minuteStr);
  
  		String secondStr = m.group(i++);
  		int second = (secondStr == null) ? 0 : Integer.parseInt(secondStr);
  
  		boolean utc = "Z".equals(m.group(i++));
  
  		return new DateTimeComponents(year, month, date, hour, minute, second, utc);
  	}
docs: Parses the components out of a date-time string.
  @param dateString the date-time string (basic and extended formats are
  supported, e.g. "20130331T020000" or "2013-03-31T02:00:00")
  @param hasTime true to force the value to be parsed as a date-time value,
  false to force the value to be parsed as a date value, null to parse the
  value however it is
  @return the parsed components
  @throws IllegalArgumentException if the date string cannot be parsed