Click to See Complete Forum and Search --> : Clock times (+8)


kidsshow
04-17-2003, 01:02 AM
Hello all,

Umm, I kindof need help with a small script:It's a clock script a bit like the "Clock Dash" (http://javascript.internet.com/clocks/clock-dash.html)

But with only the HKG (+8) time zone.

If possible, I would like it in the Clock Type (http://javascript.internet.com/clocks/clock-type.html) style.


Also, I would like it with "12 hour" selected at the begining!

*Phew* :p,
Anyways, thanks in advance,
Kidsshow
http://www.kidsshow.homestead.com

kidsshow
07-04-2003, 12:35 AM
Is this possible????


:confused:

Does ANYONE know how it can be done?


Please - Urgent help required,

Kidsshow

Charles
07-04-2003, 05:19 AM
<script type="text/javascript">
<!--
Date.ONE_SECOND = 1000;
Date.ONE_MINUTE = Date.ONE_SECOND * 60;
Date.ONE_HOUR = Date.ONE_MINUTE * 60;

Date.prototype.toUTCOffset = function (offset) {return new Date(this.getTime() + this.getTimezoneOffset() * 60000 + offset * Date.ONE_HOUR)}

Date.prototype.toTimeString = function () {return [this.getHours() < 13 ? this.getHours() : this.getHours() - 12, this.getMinutes() < 10 ? '0' + this.getMinutes() : this.getMinutes(), this.getSeconds() < 10 ? '0' + this.getSeconds() : this.getSeconds()].join (':') + (this.getHours() < 13 ? ' AM' : ' PM')}

document.write('<p id="time">-4 GMT ', new Date().toUTCOffset(-4).toTimeString(), '</p>');



if (document.getElementById) setInterval("document.getElementById('time').replaceChild(document.createTextNode ('-4 GMT ' + new Date().toUTCOffset(-4).toTimeString()), document.getElementById('time').firstChild)", 0.2 * Date.ONE_SECOND);

// -->
</script>