I have the following code to show the current date:
this.whatTime = Observable.interval(1000).map(x => new Date()).share();
And in my te
Use Angular's built-in DatePipe
:
{{ whatTime | async | date:'d/M/yy hh:mm:ss' }}
This converts Thu Sep 15 2016 18:15:17 GMT+0200 (Central Europe Daylight Time)
into your desired template: 15/9/16 06:15:17
.
You can read more about Angular's DatePipe
and its formats here and you can read more about Angular's pipes in general here.