Convert Timestamp To Date Using Angular 2 Pipes


Answer :

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



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable