Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #8032
| From | M_M <spam@the.hell> |
|---|---|
| Newsgroups | it.comp.lang.javascript |
| Subject | Re: date server |
| Date | 2016-04-30 09:26 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <ng1mfr$lhh$1@dont-email.me> (permalink) |
| References | <nfvfe9$4bm$1@dont-email.me> <doh51iF3cc2U1@mid.individual.net> <nfvtfa$qg7$1@dont-email.me> <ng057n$rg2$1@dont-email.me> |
ven, 29 apr 2016, 19:25:25, M_M ha scritto:
> Poi c'e` ancora il discorso dell'ora solare / ora legale, che non mi
> ricordo mai quando cadono, ma adesso sono stanco e per ora, se
> funzionasse veramente, andrebbe gia` bene cosi`.
Ieri avevo sottovalutato la cosa perche` non ricordavo che i cambi
semestrali non avvengono sempre negli stessi giorni ma l'ultima domenica
di Marzo e di Ottobre.
Probabilmente qualcuno avra` gia` affrontato il problema per javascript
ma io in rete non sono riuscito a trovare nulla in merito, per cui ho
pensato di risolvere la cosa utilizzando nuovamente un pizzico di PHP,
visto che il server sa se siamo un'ora o due avanti.
Questo e` il risultato, verificabile salvando il file con estensione php
e mettendolo su un server:
<html>
<head>
<script type="text/javascript">
<!--
function checkGMT() {
currentGMT = "<?php echo date('O'); ?>"
if (currentGMT = "+0200") {
n = 2
}
else {
n = 1
}
}
-->
</script>
<script type="text/javascript">
<!--
function updateClock() {
var d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000 * n));
currentRomeTime = nd.toLocaleString();
document.getElementById("clock").firstChild.nodeValue = currentRomeTime;
}
-->
</script>
</head>
<body onload="checkGMT(); updateClock(); setInterval('updateClock()', 1000 )">
<span id="clock"> </span>
</body>
</html>
Back to it.comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
date server M_M <spam@the.hell> - 2016-04-29 13:13 +0200
Re: date server Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-29 14:14 +0100
Re: date server M_M <spam@the.hell> - 2016-04-29 17:12 +0200
Re: date server M_M <spam@the.hell> - 2016-04-29 19:25 +0200
Re: date server M_M <spam@the.hell> - 2016-04-30 09:26 +0200
Re: date server M_M <spam@the.hell> - 2016-05-03 14:15 +0200
Re: date server Alex <tommaso5ita@yahoo.it> - 2016-04-29 16:57 +0200
csiph-web