0 Replies Latest reply on Oct 30, 2006 11:12 AM by AllenShorter

    Date glitch?

    AllenShorter
      What I am basically trying to do is to take a range of dates using a start date and an end date and calculate each time the first of a month is hit, but I am having a problem with this script.

      Here is what I am putting in:
      startDate = new Date(2006,9,1);
      endDate = new Date(2009,0,1);
      durationInDays = Math.floor((endDate-startDate)/86400000);
      var trackDate = new Date(startDate.getTime());
      for(u=0;u<durationInDays;u++){
      if(trackDate.getDate()==1){
      trace(trackDate);
      }
      trackDate = new Date(trackDate.getTime() + 86400000);
      }
      stop();

      Here is what I am getting out...
      Sun Oct 1 00:00:00 GMT-0400 2006
      Wed Nov 1 23:00:00 GMT-0500 2006
      Fri Dec 1 23:00:00 GMT-0500 2006
      Mon Jan 1 23:00:00 GMT-0500 2007
      Thu Feb 1 23:00:00 GMT-0500 2007
      Thu Mar 1 23:00:00 GMT-0500 2007
      Tue May 1 00:00:00 GMT-0400 2007
      Fri Jun 1 00:00:00 GMT-0400 2007
      Sun Jul 1 00:00:00 GMT-0400 2007
      Wed Aug 1 00:00:00 GMT-0400 2007
      Sat Sep 1 00:00:00 GMT-0400 2007
      Mon Oct 1 00:00:00 GMT-0400 2007
      Thu Nov 1 23:00:00 GMT-0500 2007
      Sat Dec 1 23:00:00 GMT-0500 2007
      Tue Jan 1 23:00:00 GMT-0500 2008
      Fri Feb 1 23:00:00 GMT-0500 2008
      Sat Mar 1 23:00:00 GMT-0500 2008
      Tue Apr 1 23:00:00 GMT-0500 2008
      Thu May 1 00:00:00 GMT-0400 2008
      Sun Jun 1 00:00:00 GMT-0400 2008
      Tue Jul 1 00:00:00 GMT-0400 2008
      Fri Aug 1 00:00:00 GMT-0400 2008
      Mon Sep 1 00:00:00 GMT-0400 2008
      Wed Oct 1 00:00:00 GMT-0400 2008
      Sat Nov 1 23:00:00 GMT-0500 2008
      Mon Dec 1 23:00:00 GMT-0500 2008

      Where is April 1, 2006? I noticed this happens every 6 years too. Same result in 2012, 2018, etc...

      I am running Flash Pro 8.0 on a WinXP platform.

      Some people on the actionScript.org site claim that it works fine for them, but it does not work for me on any of my three different computers I have tried...it also did not work when I tried it in macromedia flash 2004.