【问题标题】:Formatting Date and Time in Jquery Template在 Jquery 模板中格式化日期和时间
【发布时间】:2011-11-11 15:14:42
【问题描述】:

你能告诉我如何在 jquery 模板中格式化日期和时间,如下所示:

2011 年 11 月 9 日上午 12:00:00

我正在使用这个函数,它只格式化日期部分并隐藏它的时间部分:

function (jsonDate) {
    var value = new Date(parseInt(jsonDate.substr(6)));
    return value.getMonth() + 1 + "/" + value.getDate() + "/" + value.getFullYear();
}

【问题讨论】:

    标签: datetime jquery-templates


    【解决方案1】:

    怎么样:

    function (jsonDate) {
        var value = new Date(parseInt(jsonDate.substr(6)));
        return value.toUTCString();
    }
    

    你可以看到更多选项here

    【讨论】:

      猜你喜欢
      • 2011-05-19
      • 1970-01-01
      • 1970-01-01
      • 2016-03-23
      • 1970-01-01
      • 2019-01-21
      • 2011-06-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多