code: public String createMaskFromDatePattern(String datePattern) {
  		String symbols = "GyMdkHmsSEDFwWahKzZ";
  		String mask = "";
  		for (int i = 0; i < datePattern.length(); i++) {
  			char ch = datePattern.charAt(i);
  			boolean symbolFound = false;
  			for (int n = 0; n < symbols.length(); n++) {
  				if (symbols.charAt(n) == ch) {
  					mask += "#";
  					symbolFound = true;
  					break;
  				}
  			}
  			if (!symbolFound) {
  				mask += ch;
  			}
  		}
  		return mask;
  	}
docs: Creates a mask from a date pattern. This is a very simple (and
  incomplete) implementation thet works only with numbers. A date pattern
  of "MM/dd/yy" will result in the mask "##/##/##". Probably you want to
  override this method if it does not fit your needs.
  
  @param datePattern
  the date pattern
  @return the mask