I am new in angular, I am getting object through api
data= [ { "Id": 4, "IssueDate": "2021-01-25T15:17:00.85", "ExpiryDate": "2021-01-25T15:25:40.263", }, { "Id": 5, "IssueDate": "2021-01-25T15:25:40.263", "ExpiryDate": "2021-01-25T15:25:40.263" } ]
In this I am getting IssueDate and ExpiryDate I am getting in different format, I want to change it into DD-MM-YYYY so is there any way to change the format of both?
DD-MM-YYYY
You can use date pipe if you want to show them on UI. Otherwise use
this.data = this.data.map(d => ({ ...d, IssueDate: new Date(d.IssueDate), ExpiryDate: new Date(d.ExpiryDate) }))
1.4m articles
1.4m replys
5 comments
56.9k users