flash actionscript:
how do i increment a Date object by one day (i need to loop through the days in a month} ?? thx
hi please someone. this must be possible to do. i need to increment a Date object by 1 day. for example a Date object containing 25/1/2000 would turn into 26/1/2000 and 31/1/2000 would turn into 1/2/2000 that is i need something like var somedate:Date = new Date(2000,0,25); somedate++; but that doesnt work and i get an undefined .... any help would be appreciated CCCCCCCCCCChEErs
well due to popular demand i continue this discussion with myself :)) i figured out finally how to do what i need [incrementing a Date by 1], so i wrote this following function that adds either days, hours, minutes or seconds to any Date object. i didnt do the year and month increment since i never could figure out how to check whether its a 31 day / 30 day or less month, and a year might have 365 days, but also less is possible, another class i missed at highschool. right now i dont need incrementing months and years, so i didnt want to waste more time on it. anyway to your usage / correction etc etc function DateInc(aDate:Date):Date{ var D:Number = (arguments[1]!=undefined ? arguments[1] : 1); //var M:Number = (arguments[]!=undefined ? arguments[] : 0); //var Y:Number = (arguments[]!=undefined ? arguments[] : 0); var H:Number = (arguments[2]!=undefined ? arguments[2] : 0); var Min:Number = (arguments[3]!=undefined ? arguments[3] : 0); var S:Number = (arguments[4]!=undefined ? arguments[4] : 0); var TimeVal:Number = aDate.getTime(); TimeVal = TimeVal + ((((M*12 + D)*24 + H)*60 + Min)*60 + S)*1000; return (new Date(TimeVal)); }
Don't see what you're looking for? Try a search.
|