Opera's javascript time is off

Pietro Cerutti gahr at FreeBSD.org
Tue Jun 24 07:38:52 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Camilo Reyes wrote:
| All, for some reason when javascript posts the current system time inside
| of Opera, it reports it as being off by one hour. For example, when I use
| gmail chat; the time is off by one hour. Any reason that could be causing
| this odd behaviour? I've looked around the Opera site and there is nothing
| mentioned there; it's as if the javascript was using the wrong time zone.

Is your timezone UTC+1 or UTC-1? I see the same behavior here.
It seems that getTimezoneOffset() has a problem with Opera.

Try this out:
<script language="JavaScript">
~    var d = new Date();
~    document.write(d.getHours() + ":" + d.getMinutes() + ":" +
d.getSeconds());
~    document.write("<br/>Offset: " + d.getTimezoneOffset() / 120);
</script>

In Firefox:
9:36:32
Offset: -1

In Opera:
7:36:18
Offset: 0

|
| "Bono Vince Malum"
| --
| -Camilo
|
|
|
| _______________________________________________
| freebsd-questions at freebsd.org mailing list
| http://lists.freebsd.org/mailman/listinfo/freebsd-questions
| To unsubscribe, send any mail to
"freebsd-questions-unsubscribe at freebsd.org"


- --
Pietro Cerutti
gahr at FreeBSD.org

PGP Public Key:
http://gahr.ch/pgp

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEAREKAAYFAkhgpHsACgkQwMJqmJVx946cBgCg2ZT1dam3MLJUGt7w4OZDrKwR
wEkAoKyNEPV2c4nRNViueIZ6TaQzq/Li
=ZQ2E
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list