date format pipe angular code example
Example 1: pipe of date angular
content_copy
{{ dateObj | date }}
{{ dateObj | date:'medium' }}
{{ dateObj | date:'shortTime' }}
{{ dateObj | date:'mm:ss' }}
Example 2: date format angular
content_copy
@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:'h:mm a z'}}</p>
</div>`
})
export class DatePipeComponent {
today: number = Date.now();
}
Example 3: applying datepipe on interepolating date in html from typescipt
tooltip="{{recentDate | date: 'medium'}}"