forse non è proprio quello che serve a te, ma potrebbe tornarti utile
trovati su flashmxpro.com
giorni mancanti alla fine dell'anno
codice:
Date.prototype.getCommingDaysOfYear = function() {
return Math.abs(Math.floor((this-new Date(this.getFullYear()+1, 0, 1))/86400000)+((new Date(this.getFullYear(), 2, 0).getDate()) == 29 ? 1 : 0));
};
datum = new Date();
trace("Kommende Tage im Jahr: " + datum.getCommingDaysOfYear());
giorni passati dall'inizio dell'anno
codice:
Date.prototype.getElapsedDaysOfYear = function() {
return Math.floor((this-new Date(this.getFullYear(), 0, 1))/86400000)+((new Date(this.getFullYear(), 2, 0).getDate()) == 29 ? 1 : 0);
};
datum = new Date();
trace("Verstrichene Tage im Jahr: " + datum.getElapsedDaysOfYear());
verifica anno bisestile
codice:
Date.prototype.getLeapYear = function() {
return ((new Date(this.getFullYear(), 2, 0).getDate()) == 29 ? 1 : 0);
};
datum = new Date();
trace("Schaltjahr: " + datum.getLeapYear());
giorno dell'anno (progr. num dall'inizio dell'anno)
codice:
Date.prototype.getDayOfYear = function () {
return Math.floor( ( this - new Date( this.getFullYear() , 0 , 1 ) ) / 86400000 ) + ( this.getFullYear() % 4 == 0 ? 2 : 1 );
}
today = new Date();
trace ( today.getDayOfYear() );