Code:
var date = new Date().toLocaleTimeString({timezone: 'UTC'});
The result is 4 hours difference from the real current time. Could someone help?
Code:
var date = new Date().toLocaleTimeString({timezone: 'UTC'});
The result is 4 hours difference from the real current time. Could someone help?
I suppose the 4 hours difference is because you are using UTC. If that is so, then please make sure to use the correct time zone. For example:
new Date().toLocaleString('en-US', { timeZone: 'America/New_York', hour12: true });
For a list or the complete time zone values you can consult here. I hope it helps!
In the App settings, Have you set your Time zone? Perhaps this is the issue. In the client side, it will use the client time, on the server side, it will use Server time. Hope this helps!