Skip to main content
16-Pearl
October 28, 2024
Solved

While using getHours, it is not providing server time.

  • October 28, 2024
  • 1 reply
  • 517 views

let currentDate = new Date();
result = currentDate.getHours();

 

This is not returning server time. How to get server tdate and time in thingworx

Best answer by Constantine

Both new Date() and Date.now() do return server time. Mind you, when you do getHour(), it returns you the hour in the server time zone, which is often UTC, and might not be what you expect.

1 reply

18-Opal
October 29, 2024

Both new Date() and Date.now() do return server time. Mind you, when you do getHour(), it returns you the hour in the server time zone, which is often UTC, and might not be what you expect.