开发者

Using timezones on a javascript clock

I would like to use a clock like this one:

W3 schools Javascript Clock

which just outputs the current time and continues counting upwards. Is it possible to use this clock but to use timezones with it too?

I am currently using this code to output the time the page was loaded in different timezones:

$myDateTime->setTimezone(new DateTimeZone($timezone));
$myDateTime->format('H:i:s');

The variable $timezone is set from the database and contains 'Europe/London' or 'Asia/Ho_Chi_Minh' for example.

If someone could help me to get that clock working in the timezone set by $timezone I would really appreciate it.

Thanks for any help

edit: I have found this tutorial http://networking.mydesigntool.com/viewtopic.php?tid=373&id=31 which shows开发者_StackOverflow中文版 how to run a simple javascript clock and filter in the Europe/London timezones etc. Hopefully this is of some use to people in the future


You can use something like this.

Preview:

Using timezones on a javascript clock

That's my old PHP code based on timezones in PHP and JavaScript to count upwards.

Download code and try to adapt it to suit your needs.

I guess you need something like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜