DEV Community

Discussion on: How to get a city's current time independent of user's current time in JS?

Collapse
 
fasani profile image
Michael Fasani

You would pass the time from the backend to the frontend and store it on the page. Something like ‘window.currentServerTime’.

If your doing XHR sometimes you can get it from the headers. ‘ xhr.getResponseHeader(“Date”)’.