      *  object corresponding to the String.
      *  The <code>inputFormat</code> argument contains the pattern
      *  in which the <code>valueString</code> String is formatted.
-     *  It can contain <code>"M"</code>,<code>"D"</code>,<code>"Y"</code>,
+     *  It can contain <code>"M"</code>,<code>"MM"</code>,<code>"D"</code>,
+	 *  <code>"DD"</code>,<code>"YY"</code>,<code>"YYYY"</code>
      *  and delimiter and punctuation characters.
      *
      *  <p>The function does not check for the validity of the Date object.

     *  Formats a Date into a String according to the <code>outputFormat</code> argument.
     *  The <code>outputFormat</code> argument contains a pattern in which
     *  the <code>value</code> String is formatted.
     *  It can contain <code>"M"</code>,<code>"D"</code>,<code>"Y"</code>,
     *  and delimiter and punctuation characters.
     *
     *  @param value Date value to format.

     */
    public static function stringToDate(valueString:String, inputFormat:String):Date
    {
        var maskChar:String
		var dateChar:String;
		var dateString:String;
		var monthString:String;
		var yearString:String;
		var dateParts:Array = [];
		var maskParts:Array = [];
        var part:int = 0;
		var length:int = valueString.length;
		
		dateParts[part] = "";
        for (var i:int = 0; i < length; i++)
        {
			dateChar = valueString.charAt(i);
 
			if (isNaN(Number(dateChar)) || dateChar == " ")
			{
				part++;
				dateParts[part] = dateChar;
				part++;
				dateParts[part] = "";
			}
			else {
				dateParts[part] += dateChar;	
			}
		}
		
		length = inputFormat.length;
		part = -1;
		var lastChar:String;
		
		for (i = 0; i < length; i++)
		{
			maskChar = inputFormat.charAt(i);
			
			if (maskChar == "Y" || maskChar == "M" || maskChar == "D")
			{
				if (maskChar != lastChar)
				{
					part++;
					maskParts[part] = "";
				}
				maskParts[part] += maskChar;
			}
			else {
				part++;
				maskParts[part] = maskChar;
			}
			
			lastChar = maskChar;
		}
		
		length = maskParts.length;
		for (i = 0; i < length; i++) {
			maskChar = maskParts[i].charAt(0);
			
			if (maskChar == "D") {
				dateString = dateParts[i];
			}
			else if (maskChar == "M") {
				monthString = dateParts[i];
			}
			else if (maskChar == "Y") {
				yearString = dateParts[i];
			}
		}
		
		if (dateParts.length != maskParts.length)
		{
			return null;
		}
		
		var dayNum:Number = Number(dateString);
        var monthNum:Number = Number(monthString);
        var yearNum:Number = Number(yearString);

        if (isNaN(yearNum) || isNaN(monthNum) || isNaN(dayNum))
            return null;

        if (yearString.length == 2)
            yearNum += 2000;

        var newDate:Date = new Date(yearNum, monthNum - 1, dayNum);

