show current date and time in angular with am and pm 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();
}