Well, it helped when I figured out I could do things like date.date += 12 and it would automatically correct for rolling over months/years.  But at the very least, there needs to be a built-in daysBetween function.  Yes, yes, I know you can do the getTime() arithmetic.  But every time you have to fall back to that, it feels kludgy.

If I were redesigning it, it wold at least ook like this:

dayOfWeek - what used to be called day
day - day in month (used to be called date)
month - 1 based like day (what used to be called date) is
hour/minute/second/millisecond - singular (if hour is plural, why not "months"?)
year - why fullYear?  I mean, c'mon, do people really expect something called "year" to be two digits or what?
daysBetween(laterDate:date) - laterDate minus this in days

But, alas, it's too late.  There's no way they'll make the change at this late day.

I mean "date".

Haha.

On 6/23/06, Daniel Tuppeny <[EMAIL PROTECTED]> wrote:

I wouldn't disagree!
 
There seems to be no useful functions for manipulating dates. They should copy all the methods and properties from the .NET DateTime class :o)


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Pan Troglodytes
Sent: 23 June 2006 16:02
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Difference between two dates

I swear, I really think the date class was designed by a crazy man.  You hear that Adobe? - CRAZY! :D

On 6/23/06, Daniel Tuppeny < [EMAIL PROTECTED]> wrote:

I was using .day instead of .date
 
TFI Friday! =)


From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Daniel Tuppeny
Sent: 23 June 2006 15:33
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Difference between two dates

I think I need more coffee....
 
The following code (which I'm sure is correct!), returns around 2.8 when I'm expecting around 3.2. Anyone spot my error?
 
 
 
public static function getMonths(startDate:Date, endDate:Date):Number
  {
   if (startDate > endDate)
   {
    var tmp:Date = endDate;
    endDate = startDate;
    startDate = tmp;
   }
   
   var numMonths:Number = 0;
   
   // Get number of months in years
   numMonths += (endDate.fullYear - startDate.fullYear) * 12
   numMonths += endDate.month - startDate.month;
   numMonths += (endDate.day - startDate.day) / 30; // This needs fixing
   
   return numMonths;
  }

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

[Inbound Mail Scanned by MessageLabs]


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________




--
Jason

[Inbound Mail Scanned by MessageLabs]

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________




--
Jason __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to