Skip to main content
14-Alexandrite
April 23, 2024
Solved

getTimezoneOffset() returns 0

  • April 23, 2024
  • 1 reply
  • 1447 views

I am trying to write a service that returns the local time offset from UTC. I simply create a new Date() object and run the getTimezoneOffset() on this object. I verified that the date object is indeed my local time, but the getTimezoneOffset() is returning 0. How can I get the offset from UTC?

 

 

var date = new Date(); // this is returning my local date/time
var localOffset = date.getTimezoneOffset(); //this is returning 0

 

Best answer by JO_9930585

The solution is to run this in an expression. I was running this in a service which will not get local browser time even though it converts my queries to local time.

1 reply

JO_993058514-AlexandriteAuthorAnswer
14-Alexandrite
April 23, 2024

The solution is to run this in an expression. I was running this in a service which will not get local browser time even though it converts my queries to local time.