code: public static DateTimeFormatter toDateTimeFormatter(String formatName, String timeFormat) {
          DateTimeFormatter formatter = null;
      	try{
      		formatter = DateTimeFormat.forPattern(timeFormat);
      	}catch(IllegalArgumentException e){
      		//JODA's error message doesn't tell you which value sucked, so we create a better
      		// error message here.
      		IllegalArgumentException iae = new IllegalArgumentException(
      			String.format("Invalid time format for the property %s: '%s'",
      				formatName,
      				timeFormat),
      			e.getCause());
      		iae.setStackTrace(e.getStackTrace());
  
      		throw iae;
      	}
          return formatter;
      }
docs: Converts the given time format string to a {@link org.joda.time.format.DateTimeFormatter} instance.
  
  @param formatName A name used to identify the given time format. This is mainly used for error reporting.
  @param timeFormat The date time format to be converted.
  
  @return A {@link org.joda.time.format.DateTimeFormatter} instance of the given time format.
  
  @throws IllegalArgumentException if the given time format is invalid.