Re: [Flashcoders] Quick n diarty date request

2006-05-02 Thread Helen Triolo
Maybe there's something simpler, but here are two date functions (public 
static functions I have in a date utility class) that I use all the time 
(and would work for your case):


   function dateFromString(s:String):Date {
   var yr:Number = Number(s.substr(0, 4));
   var m:Number = Number(s.substr(5, 2))-1;
   var d:Number = Number(s.substr(8, 2));
   return new Date(yr, m, d);
   }

   function datesSame(d1:Date, d2:Date):Boolean {
   return (d1.getYear() == d2.getYear() &&
d1.getMonth() == d2.getMonth() &&
d1.getDate() == d2.getDate());
   }

   //Usage for your date check:

   trace(datesSame(new Date(), dateFromString('2006-05-02')));

Helen

--
http://flash-creations.com
http://i-technica.com



Manuel Saint-Victor wrote:

you ca try comparing elements of it such as getDate() and getMonth() 
instead

of the whole thing

var today=new Date();
trace(today.getMonth());


On 5/2/06, Pete Hotchkiss <[EMAIL PROTECTED]> wrote:



Is there a simple way to check if an instance of a date function is
today.

Ie

var foo = new Date();
trace(foo);

var bar = new Date(2006, 04, 02);

trace(bar)

trace(foo == bar);

Obviously that returns false as the time is incorrect.

There must be a simple way ?

Pete




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Quick n diarty date request

2006-05-02 Thread Paul BH

it depends on your level of accuracy:

lets say you want to know if the date was the same day:

var allowedDiff:Number = 24*60*60*1000 //24 hours,60 mins,60 secs,
1000 millisecs

trace(Math.abs(date1.getTime()-date2.getTime) wrote:

you ca try comparing elements of it such as getDate() and getMonth() instead
of the whole thing

var today=new Date();
trace(today.getMonth());


On 5/2/06, Pete Hotchkiss <[EMAIL PROTECTED]> wrote:
>
> Is there a simple way to check if an instance of a date function is
> today.
>
> Ie
>
> var foo = new Date();
> trace(foo);
>
> var bar = new Date(2006, 04, 02);
>
> trace(bar)
>
> trace(foo == bar);
>
> Obviously that returns false as the time is incorrect.
>
> There must be a simple way ?
>
> Pete
>
>
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Quick n diarty date request

2006-05-02 Thread Manuel Saint-Victor

you ca try comparing elements of it such as getDate() and getMonth() instead
of the whole thing

var today=new Date();
trace(today.getMonth());


On 5/2/06, Pete Hotchkiss <[EMAIL PROTECTED]> wrote:


Is there a simple way to check if an instance of a date function is
today.

Ie

var foo = new Date();
trace(foo);

var bar = new Date(2006, 04, 02);

trace(bar)

trace(foo == bar);

Obviously that returns false as the time is incorrect.

There must be a simple way ?

Pete



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Quick n diarty date request

2006-05-02 Thread Pete Hotchkiss
Is there a simple way to check if an instance of a date function is
today.

Ie

var foo = new Date();
trace(foo);

var bar = new Date(2006, 04, 02);

trace(bar)

trace(foo == bar);

Obviously that returns false as the time is incorrect.

There must be a simple way ?

Pete



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com