rss
twitter

Friday, April 17, 2009

Finding number of days between two dates in Flex

Today i found an interesting post an Flexexamples that by using simple basic arithmetic subtraction operator we can find the difference between the two different dates.
That is by subtracting one date from another date we can find out how many days are between those days.for example if you want to know the days between April 30-May28 means,just subtract April 30 from May 28 .here is the Flex code fragment to do this.

Actionscript Code:

private function calculateDays():String {
var tempDate:Date = new Date((new Date(2009,04,03)).getTime()
-(new Date(2009,03,30)).getTime());
return Math.round((tempDate.time / MS_PER_DAY) + 1).toString();
}



We can use this functionality to find the number of days in between the two selected dates in datechooser,or the days in the selected Range in Datechooser.Like that this functionality can be used where-ever the difference between the dates is needed.
Leave me a comment about this post.

Bookmark and Share

2 comments:

Anonymous,  December 15, 2010 at 8:43 PM  

Ignore spam post by Rose.

midn October 14, 2019 at 1:49 AM  
This comment has been removed by a blog administrator.

Post a Comment

Tech World

Label Cloud

Must Buy

  © Blogger templates by Ourblogtemplates.com updated with zenplate.com tips

Back to TOP