【问题标题】:Angular: DatePipe.transform returning 0 for monthAngular:DatePipe.transform 返回 0 月份
【发布时间】:2017-10-25 13:46:40
【问题描述】:

我正在使用 DatePipe 将格式为“2017 年 10 月 25 日”的日期字符串格式化为“2017 年 10 月 25 日”。下面是sn-p。

this.datePipe.transform('25-Oct-2017', 'yyyy-mm-dd')

它返回“2017-00-25”。

【问题讨论】:

标签: angular angular2-pipe


【解决方案1】:

请使用正确的表示符号

 this.datePipe.transform('25-Oct-2017', 'y-MM-dd')
  • y (2015)
  • MM (10)
  • dd (25)

【讨论】:

    猜你喜欢
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多