后端返回类型
private ZonedDateTime birthday;
Angular Doc
{{ dateObj | date }} // output is 'Jun 15, 2015'
{{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
{{ dateObj | date:'shortTime' }} // output is '9:43 PM'
{{ dateObj | date:'mmss' }} // output is '43:11'
----------------------------------------------------------------------------
@Component({
selector: 'date-pipe',
template: `<div>
<p>Today is {{today | date}}</p>
<p>Or if you prefer, {{today | date:'fullDate'}}</p>
<p>The time is {{today | date:'jmZ'}}</p>
</div>`
})
export class DatePipeComponent {
today: number = Date.now();
}
更改自己代码后
<span>{{vm.ownerPerson.birthday | date}}</span>
出生年月日 2017年7月6日
链接
【[https://angular.io/api/common/DatePipe]】