Convert timestamp to date using Angular 2 pipes Convert timestamp to date using Angular 2 pipes angular angular

Convert timestamp to date using Angular 2 pipes


As mentioned by @Perry you will need to provide the date in milliseconds. From the Angular 2 reference for date we have:

expression is a date object or a number (milliseconds since UTC epoch) or an ISO string

So it can be simply be:

{{load.loadDate * 1000 | date}}


I used:

<div>{{score.timestamp | date:'dd/MM/yyyy'}}</div>

More info in https://angular.io/api/common/DatePipe


So if your looking to change timestamp to specific date then try this:

Date(user.dob).toLocaleDateString('en-GB')


matomo