什么浏览器支持时区转换自动? [英] What browsers support timezone conversion automagic?

查看:831
本文介绍了什么浏览器支持时区转换自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在-6时间,此示例应显示Mon Dec 25 1995 07:30:00 GMT-0600(CST):

This example should display "Mon Dec 25 1995 07:30:00 GMT-0600 (CST)" if you're on a -6 time:

(new Date('Mon, 25 Dec 1995 13:30:00 GMT'))


b $ b

或js fiddle: http://jsfiddle.net/nFADG/

这种类型的转换是否支持IE和旧的Firefox?

Is this sort of conversion supported in IE and older Firefoxes?

对于所有疯狂的方法,谷歌搜索提供转换时区在js一个人可能会开始认为这里有一些问题。

For all the crazy methods that a google search offers to convert timezones in js one might start thinking there's something wrong with this one.

编辑:删除toLocaleString()以避免混淆。

removed the toLocaleString() to avoid confusion.

编辑:更改日期字符串以反映IETF标准,因为它实际上不是解析适当地在FF。 https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects / Date / parse

changed the date string to reflect the IETF standard since it actually wasn't parsing properly in FF. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse

推荐答案

我认为所有浏览器都支持转换。然而,底层操作系统同样重要,如果你在一个机器上有未更新或不完整的zoneinfo文件,你会在某些边缘情况下有问题。浏览器将其转换基于操作系统中的信息。

I would think that all browsers in themselves support the conversion. However the underlying OS is just as important, if you are on a machine with un-updated or incomplete zoneinfo files you will have problems in certain edge cases. The browser will base its conversion on information in the OS.

当使用时区检测时,我遇到了几个这样的情况,我没有真正想出一个办法。除了希望大多数用户不在说... Gaza,说... Windows XP没有服务包1。

When working with timezone detection I've come across several such cases, and I've not really come up with a solution. Except to hope that most of your users are not in say... Gaza, on say... Windows XP without even service pack 1.

这篇关于什么浏览器支持时区转换自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆