     {
         var str:String;
 
-        str = StringUtil.padLeft(date.fullYearUTC, 4, "0")  + "-" +
-              StringUtil.padLeft(date.monthUTC + 1, 2, "0") + "-" +
-              StringUtil.padLeft(date.dateUTC, 2, "0") + "T" +
-
-              StringUtil.padLeft(date.hoursUTC, 2, "0") + ":" +
-              StringUtil.padLeft(date.minutesUTC, 2, "0") + ":" +
-              StringUtil.padLeft(date.secondsUTC, 2, "0") + "Z";
+        str = StringUtil.padLeft(date.fullYearUTC, 4, "0") + "-" +
+            StringUtil.padLeft(date.monthUTC + 1, 2, "0") + "-" +
+            StringUtil.padLeft(date.dateUTC, 2, "0") + "T" +
+            StringUtil.padLeft(date.hoursUTC, 2, "0") + ":" +
+            StringUtil.padLeft(date.minutesUTC, 2, "0") + ":" +
+            StringUtil.padLeft(date.secondsUTC, 2, "0") + "Z";
 
         return str;
     }

                // of the locale.
                offset = (new Date(year, month, day, hour, minute, second)).timezoneOffset;
                trace("DateParse.parseXSDateTime: Warning: Timezone not " +
                      "specified. Timezone set to " + (offset / -60) +
                      ". String was: '" + xsDateTime + "'");
            }

            if (anyIsNaN(year, month, day, hour, minute, second))
            {
                trace("DateParse.parseXSDateTime: Warning: ParseInt " +
                      "failed. String was: '" + xsDateTime + "'");
                return null;
            }
            else
            {
                epoch = Date.UTC(year, month, day,
                                 hour, minute, second, ms) + offset * TimeUnits.MINUTE;
            }
        }
        else
        {
            trace("DateParse.parseXSDateTime: " + "RegExp failed. String " +
                  "was: '" + xsDateTime + "'");
            return null;
        }

        return new Date(epoch);

import org.yellcorp.lib.core.StringUtil;


public class XSDDate
{
    // http://www.w3.org/TR/xmlschema-2/#dateTime says:
    // '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?

    /**
     * RegExp for matching XSD:DateTimes
     */
    private static var dateTimeRE:RegExp =
    /(-?\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?([0-9:Z+-]*)/i ;
    // Year      Month   Day     Hour    Minute  Second ms      timezone

    /**
     * RegExp for matching XSD:Times
     */
    private static var timeRE:RegExp =
    /(\d{2}):(\d{2}):(\d{2})(\.\d+)?([0-9:Z+-]*)/i ;
    // Hour    Minute  Second ms      timezone

    /**
     * RegExp for matching XSD:Dates
     */
    private static var dateRE:RegExp =
    /(-?\d{4})-(\d{2})-(\d{2})/i ;
    // Year      Month   Day

    /**
     * Helper function. Returns true if any of its arguments are NaN
     */
    private static function anyIsNaN(... args):Boolean
    {
        var i:uint;
        for (i = 0; i < args.length; i++)
        {
            if (isNaN(args[i] as Number))
            {
                return true;
            }
        }
