Reputation: 580
In my response I get the field createdate: "2019-04-19T15:47:48.000+0000"
which is type of Date
and I want to show it in my grid with a different format e.g. createdate: "19/04/2019, 18:47:48"
and keep its type.
Now I convert it to string and use this to show it:
this.createdate = this.datePipe.transform(this.createdate, 'dd/MM/yyyy, HH:mm:ss');
But datePipe.transform returns type string like formatDate. How can I do it without change the type?
Upvotes: 0
Views: 410
Reputation:
You can't.
Dates have a specific format so that they can be read easily.
And pipes are used to display data, i.e. it should return a string.
Be careful about the XY problem : instead of asking this, consider explaining what is your end goal. This would allow us to help you better than helping you implementing bad practices.
Upvotes: 1