Javascript, getYear(), getFullYear(), Firefox
Il problema delle 12:31 è il seguente:
Il codice javascript:
data = new Date();
hour = data.getHours();
minute = data.getMinutes();
second = data.getSeconds();
year = data.getYear();
month = data.getMonth() + 1;
day = data.getDay() + 1;
Restituisce, come valore per year 108. Su Firefox 2. 2008 su Explorer. E’ la prima volta che mi capita di vedere funzionare meglio Explorer ma tant’è…
In ogni caso, per avere il valore corretto si può usare:
year = data.getFullYear();
e tutto si sistema.
Leave a Reply