Prototype: Date.getPeriodOfYearHemisphere [Flash 8]
| Beiträge: 130 Wohnort: Berlin/Germany Registriert: Mar 2002
| 09.01.2005, 17:13
Jahreszeiten (Nord/Süd-Halbkugel)
Prototype:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | // Jahreszeiten für die nördliche und südliche Hemisphere
Date.prototype.getPeriodOfYearHemisphere = function(pSphere)
{
var monat = this.getMonth()+1;
var tag = this.getDate();
if (pSphere)
{
// Northsphere
if ((monat<3) || ((monat == 3) && (tag<20)) || ((monat == 12) && (tag>20)))
{
return 'Winter';
}
else if ((monat<6) || ((monat == 6) && (tag<21)))
{
return 'Frühling';
}
else if ((monat<9) || ((monat == 9) && (tag<23)))
{
return 'Sommer';
}
else
{
return 'Herbst';
}
}
else
{
// Southsphere
if ((monat<3) || ((monat == 3) && (tag<20)) || ((monat == 12) && (tag>20)))
{
return 'Sommer';
}
else if ((monat<6) || ((monat == 6) && (tag<21)))
{
return 'Herbst';
}
else if ((monat<9) || ((monat == 9) && (tag<23)))
{
return 'Winter';
}
else
{
return 'Frühling';
}
}
};
ASSetPropFlags(Date.prototype, "getPeriodOfYearHemisphere", 1, true);
|
Beispiel Aufruf:
ActionScript:1 2 3 | datum = new Date();
trace("Nördliche Hemisphere: " + datum.getPeriodOfYearHemisphere(true)); // North
trace("Südliche Hemisphere: " + datum.getPeriodOfYearHemisphere(false)); // South
|
[Flashstar]
http://www.flashstar.de | |
| Ähnliche Beiträge zum Thema | |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News 
Regeln & Bedingungen
|