【问题标题】:jQuery date format returning wrong timejQuery日期格式返回错误的时间
【发布时间】:2012-04-30 05:10:23
【问题描述】:

我有如下输入日期:

2012 年 5 月 17 日星期四 18:00:00 GMT+0100 (BST)

但是,使用以下内容:

var dateString = 'hu May 17 2012 18:00:00 GMT+0100 (BST)';

document.write($.format.date(dateString, "ddd MMMM dd, HH:mm"));

结果输出比我预期的快 1 小时:

5 月 17 日星期四 18:00

似乎忽略了 GMT+0100 (BST) 部分...
有没有办法让它显示为 17:00?

【问题讨论】:

  • 不是更快,只是没有显示时区。这个字符串是从哪里来的?

标签: javascript jquery date datetime-format


【解决方案1】:

您必须明确转换时区。你可以为它创建一个单独的函数。

请查看此链接:

http://www.techrepublic.com/article/convert-the-local-time-to-another-time-zone-with-this-javascript/6016329

【讨论】:

    猜你喜欢
    • 2019-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多