3 Replies Latest reply on Nov 2, 2009 8:09 AM by MrFork

    My Date Parser

    MrFork

      Hello all, I've developed a rather simple date parser which reads in a string from SQL ('12/10/2009') and converts into a flex date. Here is the function

       

      public function parseDateFunc(s:String):Date
              {
                  var a:Array = s.split("/");
                  var newDate:Date = new Date(s);
                  newDate.fullYear = a[2]; // YEAR
                  newDate.month = a[1]; // MONTH
                  newDate.date = a[0]; // DAY
                  return newDate;
                }

       

      For some unknown, strange reason this is causing the month to be incremented by 1 month, the year and date is obsoutely as it is in SQL. I've tried not using the date parser and it comes into flex as it shows in SQL.

       

      Anyone have any ideas?