【问题标题】:Typescript & Moment.js: Format Date to ISO DateTime stringTypescript 和 Moment.js:将日期格式化为 ISO 日期时间字符串
【发布时间】:2019-05-16 08:32:08
【问题描述】:

我正在使用 Typescript 3.4.3。

我需要将 Date 对象格式化为 ISO DateTime 字符串。

有人可以添加一些简单的帮助示例吗?

【问题讨论】:

    标签: typescript momentjs


    【解决方案1】:

    你可以使用toISOString来做到这一点

    var dateObj = new Date('2019-05-28');
    moment(dateObj).toISOString();
    

    【讨论】:

      猜你喜欢
      • 2020-11-13
      • 2020-08-07
      • 1970-01-01
      • 1970-01-01
      • 2012-09-07
      • 1970-01-01
      • 2021-11-24
      • 2019-02-27
      相关资源
      最近更新 更多