首页 > 解决方案 > 如何使用日期管道以角度格式化日期数组?

问题描述

我有一系列日期,就像

      [
        "2019-06-17 09:21:20+05:30",
        "2019-06-18 09:21:20+05:30",
        "2019-06-19 09:21:20+05:30",
        "2019-06-20 09:21:20+05:30"
      ]

如何使用 datepipe 将其转换为日期时间。

标签: typescriptangular7date-pipe

解决方案


import the DatePipe to your app.module file import { DatePipe} from '@angular/common'

and format your date objects using this Pre-defined format options

and include this code to your app.component.html page

{{ DateObjectValue | date:'medium'}}

see the attached stackblitz example link : FormatDateExample


推荐阅读