blueberry
11-08-2005, 03:06 AM
GMT Time Script:
http://www.crays.com/jsc/jsC4Udate.htm
Shown below is a script that displays GMT 24-hour time, which should switch from 23:59 to 00:00 at 12 midnight.
However, instead of changing to 00:00, it goes on to show 24:00 - not a big deal, but we know it’s a little funky-looking for some visitors.
At 1am, it finally changes to 01:00…
We would really appreciate it if you could fix this? (Or you might know a better one?)
Thanks so much!!!
Blueberry
---------------------------------
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
var curDateTime = new Date()
var curHour = curDateTime.getHours()
+ curDateTime.getTimezoneOffset()/60
if (curHour > 24) curHour -= 24
if (curHour < 0) curHour += 24
var curMin = curDateTime.getMinutes()
var curSec = curDateTime.getSeconds()
var curTime =
((curHour < 10) ? "0" : "") + curHour + ":"
+ ((curMin < 10) ? "0" : "") + curMin + ":"
+ ((curSec < 10) ? "0" : "") + curSec
document.write(curTime + " GMT")
//-->
</SCRIPT>
http://www.crays.com/jsc/jsC4Udate.htm
Shown below is a script that displays GMT 24-hour time, which should switch from 23:59 to 00:00 at 12 midnight.
However, instead of changing to 00:00, it goes on to show 24:00 - not a big deal, but we know it’s a little funky-looking for some visitors.
At 1am, it finally changes to 01:00…
We would really appreciate it if you could fix this? (Or you might know a better one?)
Thanks so much!!!
Blueberry
---------------------------------
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
var curDateTime = new Date()
var curHour = curDateTime.getHours()
+ curDateTime.getTimezoneOffset()/60
if (curHour > 24) curHour -= 24
if (curHour < 0) curHour += 24
var curMin = curDateTime.getMinutes()
var curSec = curDateTime.getSeconds()
var curTime =
((curHour < 10) ? "0" : "") + curHour + ":"
+ ((curMin < 10) ? "0" : "") + curMin + ":"
+ ((curSec < 10) ? "0" : "") + curSec
document.write(curTime + " GMT")
//-->
</SCRIPT>