Comparing Dates in Flex.

They are many versions out there to do this, but my version is here. It’s pretty simple, clean and easy.

Check the code Example below::

var strDate1:String=”01/04/2008″;
var strDate2:String=”31/03/2009″;
var strMyDate:String=”10/12/2008″;
if(DateField.stringToDate(strMyDate,’DD/MM/YYYY’)>=DateField.stringToDate(strDate1,’DD/MM/YYYY’)
&& DateField.stringToDate(strMyDate,’DD/MM/YYYY’)<=DateField.stringToDate(strDate2,’DD/MM/YYYY’))
{
trace(“Date is in Financial Year Range”);
}
else
{
trace(“Date is not in Financial Year Range”);
}

Here iam using the DateField Class and its methods.

Enjoy the Post.


Advertisements

One Response to Comparing Dates in Flex.

  1. sreeja says:

    a direct solution.Thanks alot!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: