Hi
Ich hab mir einen script geschrieben der das aktuelle datum ausgeben sollte
Code
var now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
thetime = (hours < 10) ? "0" + hours + ":" : hours + ":";
thetime += (minutes < 10) ? "0" + minutes + ":" : minutes + ":";
thetime += (seconds < 10) ? "0" + seconds : seconds;
month = new Array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
day = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
var theDay = day[now.getDay()];
var theMonth = month[now.getMonth()];
var theYear = now.getYear();
if(theYear<1000) theYear+=1900;
thedate = theDay + ", " + now.getDay() + ". " + theMonth + " " + theYear + " - ";
element = document.getElementById("time");
element.innerHTML = thedate + thetime;
Alles anzeigen
Aber leider ist heue ja der 3??
Was habe ich falsch gemacht?