comparing the time in milli seconds is accurate, no complex code,
hence bug free

Bobbyinsane
http://www.insanepixel.com



On Mar 30, 8:33 pm, "sambhavg...@gmail.com" <sambhavg...@gmail.com>
wrote:
> Hi,
>
> Adding to what GAGAN has said, you can compare the two date objects by
> comparing both into milliseconds, like this:
>
> firstDateMilliSeconds:Number = fdate.getTime();
> secondDateMilliSeconds:Number = sdate.getTime();
>
> And then you can compare the two.
>
> HTH,
> Sambhav
>
> On Mar 30, 4:36 pm, GAGAN anand <gds.anan...@gmail.com> wrote:
>
> > Hi Krishna
>
> > you can use the Date class of flex. You can convert the selected time from
> > combobox to the time of date class and then can check which one is greater.
> > This is an example
>
> > *
>
> > private* *function* test():*void*{
>
> > *var* fdate:Date = *new* Date();
>
> > *var* sdate:Date = *new* Date();
>
> > fdate.setHours(cb1.selectedItem.text.substr(0,2),cb1.selectedItem.text.subs 
> > tr(3,2),0);
>
> > *trace*(*"time : "*+fdate.toTimeString());
>
> > sdate.setHours(cb2.selectedItem.text.substr(0,2),cb2.selectedItem.text.subs 
> > tr(3,2),0);
>
> > *trace*(*"second time : "*+sdate.toTimeString());
>
> > }
>
> > This setHours will convert the time according to the date class time and
> > then you can compare between the two time. You have to write the condition
> > for AM and PM also.
>
> > Hope this helps
>
> > Regards
> > Gagan Deep
> > 2009/3/30 krishna <krishnamrajg...@gmail.com>
>
> > > hi all,
> > >             i want to compare two times.ie; i have two comboboxes
> > > fromTime & toTime. both populated with 12.00AM-11.45PM.  I want to
> > > compare the timings selected by the user. ie; if the start time is
> > > greater than end time im not allowed to fire an event and if starttime
> > > is less than end time you can fire the event. can anyone help me out
> > > on this.
>
> > > thanks and regards.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_india@googlegroups.com
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to