Thank you, this is working nicely

-Mark


--- In flexcoders@yahoogroups.com, "Doug Lowder" <[EMAIL PROTECTED]> 
wrote:
>
> Your math is OK, but for timezones that support Daylight Savings 
Time 
> your logic isn't.  In those timezones, not every day will be 
exactly 
> 24 hours long.  A quick way to verify is to make the following 
change:
> 
>    hListArray.addItem(lastDate.toUTCString());
> 
> If you need dates converted to local time, you'll have to adjust 
for 
> the timezone offset of the date in question.  I think the 
following 
> should work:
> 
>    var lastDate:Date = new Date(nextDay);
>    lastDate.setTime(lastDate.getTime() - lastDate.getTimezoneOffset
()
> *60000);
>    hListArray.addItem(lastDate.toLocaleString());
> 
> You may also have a few issues to sort out regarding the timezone 
of 
> the stored dates, and how those stored values are initially 
converted 
> to local dates.
> 
> 
> --- In flexcoders@yahoogroups.com, "Mark" <pusateri02@> wrote:
> >
> > I'm having some problems with my, I think, math for getting all 
the 
> > days into an arrayCollection.  It works well on items with less 
> time 
> > between start and end dates such as a few days or months apart.  
> But 
> > when it gets up to about 200+ days something strange happens, it 
> > changes from Date "Sun Nov 5 2006 12:00:00 AM" to "Sun Nov 5 
2006 
> > 11:00:00 PM".  Then a few months down it will switch back to 
12.  
> So 
> > I guess that's why I think it may be my Math.  I'd like someone 
to 
> > double check what I'm doing because I can't see the error.  The 
> > dates are stored like "2007,12,25"
> > 
> > 
> > 
> > var StartDate:String = item.startDate;
> > var startResults:Array = StartDate.split(",");
> > var nsd:Date = new Date(startResults[0],startResults[1]-
> > 1,startResults[2],0,0,0,0);
> > trace("SD  " + nsd);
> > //
> > var ENDDate:String = item.endDate;
> > var ENDResults:Array = ENDDate.split(",");
> > var ned:Date = new Date(ENDResults[0],ENDResults[1]-1,ENDResults
> > [2],0,0,0,0);
> > trace("ED  " + ned);
> > // test for all days
> > var millisecondsPerDay:int = 1000 * 60 * 60 * 24 //86400000;
> > var totalDays:Number = (ned.getTime() - nsd.getTime
> > ())/millisecondsPerDay+1;
> > trace("total " + totalDays);
> > var nextDay:Number = nsd.getTime();
> > 
> > hListArray.removeAll();
> > for(var i:int = 0; i<totalDays; i++){
> >   var lastDate:Date = new Date(nextDay)
> >   hListArray.addItem(lastDate.toLocaleString());
> >   nextDay += millisecondsPerDay;
> > }
> >
>


Reply via email to