/*
              This function will compare the two dates date_one and
date_two. It will return a Boolean value which is 1 if date_one is
bigger than that date_two
              otherwise it wil be zero. To be more specific the variable
will be zero if date_one is equal to date_two or date_one is less than
date_two.
              Author: Akhil Mittal
              Date: June 09, 2009.
             */
            private function compareDates(date_one:Date, date_two:Date)
            {
                /*
                 Here the three variables date_first, month_first and
year_first will have the date, month and year of the first date and
date_second, month_second
                 and year_second will have the corresponding values of the
second year. Suppose S denotes that variables are same, L denotes
first is larger than second
                  and M denotes first is smaller than second corresponding
variable. Now the following cases will lead to true value:
                  S(==) L(>) M(<)
                   Date(D)                      Month(M)                        
Year(Y)
                        S                                       S               
                        L
                        S                                       L               
                        S
                        S                                       L               
                        L
                        L                                       S               
                        S
                        L                                       S               
                        L
                        L                                       L               
                        S
                        L                                       L               
                        L
                        L                                       M               
                        L
                        M                                       S               
                        L
                        M                                       L               
                        S
                        M                                       L               
                        L
                        M                                       M               
                        L
                */
                var date_first:int = date_one.date;
                var month_first:int = date_one.month;
                var year_first:int = date_one.getFullYear();
                var date_second:int = date_two.date;
                var month_second:int = date_two.month;
                var year_second:int = date_two.getFullYear();
                var comparedValue:Boolean = false;

                if (date_first == date_second)
                {
                                if( (month_first == month_second) && 
(year_first >
year_second) )  //Case One
                                {
                                                                        
comparedValue = true;
                                }
                                if( month_first > month_second)
                                {
                                                if( (year_first == 
year_second)||(year_first >
year_second) )  //Case two and three
                                                {
                                                                        
comparedValue = true;
                                                }
                                }
                                if( (month_first < month_second) || (year_first 
>
year_second) )  //Case four
                                {
                                                comparedValue = true;
                                }
                }

                        if(date_first > date_second)
                        {
                                        if(month_first == month_second)
                                        {
                                                        if( (year_first == 
year_second) || (year_first >
year_second) )//Case five and six
                                                        {
                                                                        
comparedValue = true;
                                                        }
                                        }
                                        if(month_first > month_second)
                                        {
                                                        if( (year_first == 
year_second) || (year_first >
year_second) )//Case seven and eight
                                                        {
                                                                comparedValue = 
true;
                                                        }
                                        }
                                        if( (month_first < month_second) && 
(year_first >
year_second) ) //Case nine
                                        {
                                                                comparedValue = 
true;
                                        }
                        }

                if(date_first < date_second)
                {
                                if( (month_first == month_second) && 
(year_first >
year_second) )  //Case ten
                                {
                                                comparedValue = true;
                                }
                                if(month_first > month_second)
                                {
                                                if( (year_first == year_second) 
|| (year_first >
year_second))   //Case eleven and twelve
                                                {
                                                                comparedValue = 
true;
                                                }
                                }
                                if( (month_first < month_second) && (year_first 
>
year_second) )  //Case thirteen
                                {
                                                                comparedValue = 
true;
                                }
                }

                return comparedValue;
            }

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

Reply via email to