0

I have a cloud based application with client side code in angular5 and server side code in asp.net MVC5. I am showing my cloud server's date time on dash board. I want to change/update the time on dashboard every minute but without giving call back to server. How can I do this?

I want to change time at client side only and don't want to give calls to server again and again to update time on dashboard. How to do this?

//data[0]['NOW()'] = This is time from dashboard

this.commonService.getCurrentDateTime().subscribe(data => {  
    var datePipe = new DatePipe('en-US');

    setInterval(() => {
      debugger;
      this.today = new Date(data[0]['NOW()']);

      }, 1); 

    });
carme
  • 25
  • 8

1 Answers1

0

Instead of using server call use server time zone and convert current date to server time zone

new Date().toLocaleString("en-US", {timeZone: yourservertimezone});

Check this out for more info

jitender
  • 10,238
  • 1
  • 18
  • 44