Either I've missed something, or there is no DateAdd() function built into the basic Flex installation. Well that simply won't do, I need to be able to add dates! There's no DateDiff(), either. I must be missing something.

private function DateAdd(origDate:Date, addVal:int, addUnit:String):Date{
   var newDate:Date;

   switch(addUnit){
      case 'y':
         newDate = new Date(origDate.fullYear+addVal, origDate.month, origDate.date);
         break;
      case 'm':
         newDate = new Date(origDate.fullYear, origDate.month+addVal, origDate.date);
         break;
      case 'd':
         newDate = new Date(origDate.fullYear, origDate.month, origDate.date+addVal);
         break;
   }

   return newDate;
}

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner