阅读:5888回复:9
请教Date对象的toLocaleString函数在IE和Fx的差异var today; today = new Date(); alert ( today.toLocaleString() ); toLocaleString在IE中显示格式为 2005年5月9日 13:57:46 在Fx中显示 Monday, May 09, 2005 13:55:50 为什么IE和Firefox又不统一呢? 是不是与系统依赖性有关系呢? |
|
1楼#
发布于:2005-05-09 14:02
搞定了吗?
一定要分解处理吗? |
|
2楼#
发布于:2005-05-09 14:02
如果toLocaleString是按照这个参数传递的话
http://lxr.mozilla.org/aviary101branch/ ... ate.c#1656 发觉我写的例程照样是 Thursday, May 12, 2005 23:56:02 怀疑是操作系统问题 ![]() #include <stdio.h> #include <time.h> int main(int argc, char* argv[]) { time_t t; time(&t); const long ct = t; char s[50]; strftime(s, 50, "%#c", localtime(&ct)); printf(s); printf("\n"); return 0; } |
|
3楼#
发布于:2005-05-09 14:02
|
|
4楼#
发布于:2005-05-09 14:02
![]() ![]() |
|
5楼#
发布于:2005-05-09 14:02
javascript:alert(new Date().toLocaleString())
我这里 ff ie 显示一样 2005年5月12日 17:02:12 opera 显示 2005-5-12 17:01:33 |
|
6楼#
发布于:2005-05-09 14:02
能做个test case么?一个html文件就可以.
|
|
7楼#
发布于:2005-05-09 14:02
不行。两个浏览器返回的结果不同,不能统一处理。变相解决吧get一堆。
按标准说,应该根据用户的操作系统设置来给出结果。 |
|
8楼#
发布于:2005-05-09 14:02
最后搞定了么?
|
|
9楼#
发布于:2005-05-09 14:02
The toLocaleString method relies on the underlying operating system in formatting dates. It converts the date to a string using the formatting convention of the operating system where the script is running. For example, in the United States, the month appears before the date (04/15/98), whereas in Germany the date appears before the month (15.04.98). If the operating system is not year-2000 compliant and does not use the full year for years before 1900 or over 2000, toLocaleString returns a string that is not year-2000 compliant. toLocaleString behaves similarly to toString when converting a year that the operating system does not properly format.
|
|