refresh date and time every second angular
snippet in javascript

refresh date and time every second angular

user3251

setInterval(() => {         
  //replaced function() by ()=>
  this.myDate = new Date();
  console.log(this.myDate); 
  // just testing if it is working
}, 1000);