lundi 27 février 2017

Actionscripts 3 Function doesn't work

I write some code for getting current date and compare it with a future date for application limitation. I don't know why this function doesn't work.

getYYMMDD();

function getYYMMDD(): String {
    var dateObj: Date = new Date();
    var year: String = String(dateObj.getFullYear());
    var month: String = String(dateObj.getMonth() + 1);
    if (month.length == 1) {
        month = "0" + month;
    }
    var date: String = String(dateObj.getDate());
    if (date.length == 1) {
        date = "0" + date;
    }
    return year.substring(0, 4) + month + date;

    trace(year + ":" + month + ":" + date);
    if (int(year) > 2017 && int(month) > 5 && int(date) > 31) {
        trace("SYSTEM TIME IS OFF.");
    } else {
        trace("SYSTEM TIME IS ON.");
    }
}

Aucun commentaire:

Enregistrer un commentaire