Re: [flexcoders] Difference between two dates

2006-06-28 Thread Pan Troglodytes



I understand that.  I would also like to lobby for changes to Date.  Maybe I should just write my own library that expects the date to be a floating point number of days (like Delphi and others).  As it stands, this illustrates the big problem with the date class:

http://www.adobe.com/2006/mxml" layout="absolute">
      
    
  
  
    The first two buttons don't work as expected.  That is, if you expect to fully take advantage of Flex's great databinding technology.  Instead, everywhere you simply want to increment/decrement/change the date, you have to jump through hoops to create a new date or write invalidation calls whenever you change it.  Or you do silly things like the second two buttons.  This is unavoidable for my complex objects, but dates should be as simple to use as ints and strings.
Frankly, I feel like I'm going back in time when I work with Date.  Flex has spoiled me :DOn 6/23/06, Gordon Smith <
[EMAIL PROTECTED]> wrote:








  











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

 

I heard it. But we didn't design the Date
class; it's part of the existing _javascript_/Ecmascript standards that we've followed
in ActionScirpt 3.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of Pan Troglodytes
Sent: Friday, June 23, 2006 8:02
AM
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 










  













-- 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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Difference between two dates

2006-06-27 Thread Daniel Tuppeny





I tried that, and it just didn't work. Returned completely 
wrong numbers! I tried stepping through it, but didn't really understand all the 
magic numbers (like subtracing 1 from the month if one date is lower than the 
other).
 
I got it working with the code I posted, it's just annoying 
that we have to implement something so trivial (so there'll be tons of different 
buggy implementations doing the rounds soon!)


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas 
KnudsenSent: 26 June 2006 19:56To: 
flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
between two dates
http://jeff.mxdj.com/datediff_for_actionscript.htmperhaps 
this would be helpful.DK
On 6/26/06, Kelly 
Birr <[EMAIL PROTECTED]> 
wrote:

  
  
  If you do not wish to 
  change the Date class so it will conform to a (terrible) standard, I can sort 
  of understand that.  
   
  Would you please 
  consider the possibility of adding a DateTime or Date2 class in Flex 2.1 that 
  works like a primitive type.  Or better yet, make the new class 
  be Date and the standards-compliant one called EcmaDate or EDate or CDate 
  or something like that. :)
   
  - 
  Kelly
  
  
  
  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Daniel 
  Tuppeny
  Sent: Monday, June 26, 2006 1:03 
  AMTo: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Difference between two 
  dates
  
  
  
  > Since the Date class 
  is specified by the EcmaScript-262 standard, we're not going to change 
  it
   
  That's fair enough, 
  but as things are (without a utility class to do this stuff), I can see there 
  being a whole bunch of "buggy" implementations of date stuff in Flex over the 
  coming months, which will be spread amongst developers via sites like 
  CodeProject!! :-(
  
  
  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon 
  SmithSent: 24 June 2006 00:01To: flexcoders@yahoogroups.comSubject: RE: 
  [flexcoders] Difference between two dates
  
  
  Since the Date class 
  is specified by the EcmaScript-262 standard, we're not going to change it. But 
  it sounds like we should consider adding a flex.utils.DateUtils class in the 
  future to make date manipulation easier.
   
  - 
  Gordon
   
  
  
  
  
  From: flexcoders@yahoogroups.com [mailto: 
  flexcoders@yahoogroups.com] On Behalf 
  Of Pan TroglodytesSent: Friday, June 23, 2006 8:53 
  AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
  between two dates
   
  
  
  
  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 dayday - day in month 
  (used to be called date)month - 1 based like day (what used to be called 
  date) ishour/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 TroglodytesSent: 23 June 2006 16:02To: flexcoders@yahoogroups.comSubject: 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 TuppenySent: 23 June 2006 15:33To: flexcoders@yahoogroups.comSubject: 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 
  num

RE: [flexcoders] Difference between two dates

2006-06-26 Thread Kelly Birr





Yes thank you, this is helpful.  I did already have some routines 
built to do this but this one is a bit better.  Never-the-less I still 
believe the language would be improved by making a Date primitive.  

 
Just because we have workarounds does not mean we should settle 
for them.  The fact still remains that this requires extra code, 
especially if your trying to do a comparison between 2 variables whose 
actual types you don't know (or care) and just want to know if they are 
equivalent or not.
 
I understand that it's way too late in the Flex 2.0 game for any of this, 
but here's hoping for Flex 2.1
 
- Kelly 


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas 
KnudsenSent: Monday, June 26, 2006 11:56 AMTo: 
flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
between two dates
http://jeff.mxdj.com/datediff_for_actionscript.htmperhaps 
this would be helpful.DK
On 6/26/06, Kelly 
Birr <[EMAIL PROTECTED]> 
wrote:

  
  
  If you do not wish to 
  change the Date class so it will conform to a (terrible) standard, I can sort 
  of understand that.  
   
  Would you please 
  consider the possibility of adding a DateTime or Date2 class in Flex 2.1 that 
  works like a primitive type.  Or better yet, make the new class 
  be Date and the standards-compliant one called EcmaDate or EDate or CDate 
  or something like that. :)
   
  - 
  Kelly
  
  
  
  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Daniel 
  Tuppeny
  Sent: Monday, June 26, 2006 1:03 
  AMTo: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Difference between two 
  dates
  
  
  
  > Since the Date class 
  is specified by the EcmaScript-262 standard, we're not going to change 
  it
   
  That's fair enough, 
  but as things are (without a utility class to do this stuff), I can see there 
  being a whole bunch of "buggy" implementations of date stuff in Flex over the 
  coming months, which will be spread amongst developers via sites like 
  CodeProject!! :-(
  
  
  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon 
  SmithSent: 24 June 2006 00:01To: flexcoders@yahoogroups.comSubject: RE: 
  [flexcoders] Difference between two dates
  
  
  Since the Date class 
  is specified by the EcmaScript-262 standard, we're not going to change it. But 
  it sounds like we should consider adding a flex.utils.DateUtils class in the 
  future to make date manipulation easier.
   
  - 
  Gordon
   
  
  
  
  
  From: flexcoders@yahoogroups.com [mailto: 
  flexcoders@yahoogroups.com] On Behalf 
  Of Pan TroglodytesSent: Friday, June 23, 2006 8:53 
  AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
  between two dates
   
  
  
  
  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 dayday - day in month 
  (used to be called date)month - 1 based like day (what used to be called 
  date) ishour/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 TroglodytesSent: 23 June 2006 16:02To: flexcoders@yahoogroups.comSubject: 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 TuppenySent: 23 June 2006 15:33To: flexcoders@yahoogroups.comSubject: 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?
   
   
   
  pu

Re: [flexcoders] Difference between two dates

2006-06-26 Thread Douglas Knudsen



http://jeff.mxdj.com/datediff_for_actionscript.htmperhaps this would be helpful.DKOn 6/26/06, 
Kelly Birr <[EMAIL PROTECTED]> wrote:









If you do not wish to change the Date class so it will conform to a 
(terrible) standard, I can sort of understand 
that.  
 
Would you please consider the possibility of adding a DateTime or Date2 
class in Flex 2.1 that works like a primitive type.  Or better yet, make 
the new class be Date and the standards-compliant one called EcmaDate or 
EDate or CDate or something like that. :)
 
- Kelly


From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] On Behalf Of Daniel 
TuppenySent: Monday, June 26, 2006 1:03 AMTo: 
flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Difference 
between two dates

> Since the Date class is 
specified by the EcmaScript-262 standard, we're not going to change 
it
 
That's fair enough, but 
as things are (without a utility class to do this stuff), I can see there being 
a whole bunch of "buggy" implementations of date stuff in Flex over the coming 
months, which will be spread amongst developers via sites like 
CodeProject!! :-(


From: flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon 
SmithSent: 24 June 2006 00:01To: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Difference 
between two dates


Since the Date class is 
specified by the EcmaScript-262 standard, we're not going to change it. But it 
sounds like we should consider adding a flex.utils.DateUtils class in the future 
to make date manipulation easier.
 
- 
Gordon
 




From: 
flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of Pan TroglodytesSent: Friday, June 23, 2006 8:53 
AMTo: 
flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
between two dates
 



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 dayday - day in month (used 
to be called date)month - 1 based like day (what used to be called date) 
ishour/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 TroglodytesSent: 23 June 2006 16:02To: 
flexcoders@yahoogroups.comSubject: 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 TuppenySent: 
23 June 2006 15:33To: 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

RE: [flexcoders] Difference between two dates

2006-06-23 Thread Gordon Smith










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

 

I heard it. But we didn't design the Date
class; it's part of the existing _javascript_/Ecmascript standards that we've followed
in ActionScirpt 3.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pan Troglodytes
Sent: Friday, June 23, 2006 8:02
AM
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 






__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Difference between two dates

2006-06-23 Thread Gordon Smith










Since the Date class is specified by the
EcmaScript-262 standard, we're not going to change it. But it sounds like we
should consider adding a flex.utils.DateUtils class in the future to make date
manipulation easier.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pan Troglodytes
Sent: Friday, June 23, 2006 8:53
AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders]
Difference between two dates



 







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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Difference between two dates

2006-06-23 Thread Tracy Spratt










Have you looked into the AS 3 libraries? 
I found this on dates manipulation:

http://weblogs.macromedia.com/as_libraries/docs/corelib/

Look at DateUtil

Tracy

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Tuppeny
Sent: Friday, June 23, 2006 12:01
PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders]
Difference between two dates



 







> things like date.date += 12 

 

I didn't know that. That's certainly a bit
better! I was frustrated there was no AddDays() etc.!

 

 

> Yes, yes, I know you can do the getTime() arithmetic

 

You can't. Because once you detach the
length of time from the actual dates, you can't figure out the number of months
accurately (because of the difference in days). I originally did GetTime of
both dates, and then created a date from the difference (and took away 1970
years), but the length was then out by a number of days! :-(

 

 

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


I agree - it was the day/date that had me spending an hour to do simple maths!

  

 

>year - why fullYear?

 

This got me too... .year appears in the
intellisense, but when I used it, I got an error - WTF?!

It wouldn't be so bad if they'd actually
added a 2-figure year, but they dumped .year, and added fullYear. Grrr!

 







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

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. 
__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__






__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Difference between two dates

2006-06-23 Thread Daniel Tuppeny





> things like date.date += 12 
 
I didn't know that. That's certainly a bit better! I 
was frustrated there was no AddDays() etc.!
 
 
> Yes, yes, I know you can do the getTime() 
arithmetic
 
You can't. Because once you detach the length of time 
from the actual dates, you can't figure out the number of months accurately 
(because of the difference in days). I originally did GetTime of both dates, and 
then created a date from the difference (and took away 1970 years), but the 
length was then out by a number of days! :-(
 
 
> If I were redesigning it, it wold at least ook like 
this:
I agree - it was the day/date that had me spending 
an hour to do simple maths!
 
 
>year - why fullYear?
 
This got me too... .year appears in the intellisense, 
but when I used it, I got an error - WTF?!
It wouldn't be so bad if they'd actually added a 
2-figure year, but they dumped .year, and added fullYear. 
Grrr!


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Pan 
TroglodytesSent: 23 June 2006 16:53To: 
flexcoders@yahoogroups.comSubject: Re: [flexcoders] Difference 
between two dates
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 
dayday - day in month (used to be called date)month - 1 based like day 
(what used to be called date) ishour/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.

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

__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Difference between two dates

2006-06-23 Thread Pan Troglodytes



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 dayday - 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 
TroglodytesSent: 23 June 2006 16:02To: 
flexcoders@yahoogroups.comSubject: 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 
  TuppenySent: 23 June 2006 15:33To: flexcoders@yahoogroups.comSubject:
 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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Difference between two dates

2006-06-23 Thread Daniel Tuppeny





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:[EMAIL PROTECTED] On Behalf Of Pan 
TroglodytesSent: 23 June 2006 16:02To: 
flexcoders@yahoogroups.comSubject: 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 
  TuppenySent: 23 June 2006 15:33To: flexcoders@yahoogroups.comSubject: 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 
__

__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Difference between two dates

2006-06-23 Thread Pan Troglodytes



I swear, I really think the date class was designed by a crazy man.  You hear that Adobe? - CRAZY! :DOn 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 
TuppenySent: 23 June 2006 15:33To: 
flexcoders@yahoogroups.comSubject: 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

__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Difference between two dates

2006-06-23 Thread Daniel Tuppeny





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


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Daniel 
TuppenySent: 23 June 2006 15:33To: 
flexcoders@yahoogroups.comSubject: 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 
__

__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Difference between two dates

2006-06-23 Thread Daniel Tuppeny





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 
__

__._,_.___





--
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



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___