export class myComponent implements OnInit { currentTime:string; constructor() { } ngOnInit() { setInterval(() => { this.currentTime = new Date().toTimeString(); }, 100); } }