hey I have a javascript algorithm, you might have to convert it in
ActionScript. I am sure it wont be much hard for you if you know the
basics of ECMA  or JavaScript,
// currentDateStart is the 1st of the current month
var currentDateStart = new Date;
currentDateStart.setDate(1);
currentDateStart.getUTCMonth();
var m = currentDateStart.getUTCMonth();
currentDateStart.getUTCFullYear();
var y = currentDateStart.getUTCFullYear();

// currentDateEnd is the 1st of the next month
var currentDateEnd = new Date;
currentDateEnd.setDate(1);
var endMonth = currentDateStart.getUTCMonth();
var endYear = currentDateStart.getUTCFullYear();
if (endMonth < 10) {
        endMonth += 1;
}
else {
        endMonth = 1;
        endYear += 1;
}
currentDateEnd.setMonth(endMonth);
currentDateEnd.setFullYear(endYear);
// once you have the 1st of next month you need to subtract one day
// to get the date of the last day of the current month you need to
// subtract 86400000 milliseconds which is the value for one day
// this will save time leap years ect.
var endDate = new Date( currentDateEnd.getTime() - 86400000 );
var endDateDay = endDate.getDate();

// this function loops through each day and finds the mondays
// and places them in to an array
var mondayArray = new Array();
var c = 0;
function getMondayArray() {
        var loopDate = new Date;
        var dayName;
        var lDay;
        var lMonth;
        for (var d=1;d<=endDateDay;d++) {
                loopDate.setDate(d);
                loopDate.setMonth(m);
                loopDate.setFullYear(y);
                dayName = loopDate.getDay();
                // the getDay value for monday is 1
                if (dayName == 1) {
                        c += 1;
                        lDay = loopDate.getDate();
                        if (lDay < 10) lDay = "0" + lDay;
                        lMonth = (loopDate.getMonth() + 1)
                        if (lMonth < 10) lMonth = "0" + lMonth;
                        mondayArray[c] = (lDay + "-" + lMonth + "-" + 
loopDate.getFullYear
());
                }
        }
}

// this function collects the data and displays it on the page
function displayResults() {
        var headerSpan = "";
        var resultsSpan = "";
        var sDay = currentDateStart.getDate();
        if (sDay < 10) sDay = "0" + sDay;
        var sMonth = (currentDateStart.getMonth() + 1);
        if (sMonth < 10) sMonth = "0" + sMonth;
        headerSpan += ("<h2>Date Range: 01" + "-" + sMonth + "-" +
currentDateStart.getFullYear() + " to ");
        var eMonth = (endDate.getMonth() + 1);
        if (eMonth < 10) eMonth = "0" + eMonth;
        headerSpan += (endDate.getDate() + "-" + eMonth + "-" +
endDate.getFullYear() + "</h2>");

        resultsSpan += ("<b>RESULTS: " + c + "</b>");
        for (var r=1;r<=c;r++) {
                resultsSpan += ("<br />" + mondayArray[r]);
        }

        document.getElementById("headerSpan").innerHTML = headerSpan;
        document.getElementById("resultsSpan").innerHTML = resultsSpan;
}

function show_dates() {
        getMondayArray();
        displayResults();
}

Anand

On Feb 27, 7:12 pm, Thalai raju <[email protected]> wrote:
> hi Masters,
>
>              how to find between to selected dates.how many Monday ,
> ......... Sunday  in that selected  b/w dates.and total date
>
> pleace any body help me
>
> Tks & Advance
> Rajesh
> Atelier-soft
> Chennai
--~--~---------~--~----~------------~-------~--~----~
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