Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vbacct
Visitor

wrong values for timeZoneOffset

Hello
We are seeing erroneous timeZoneOffSet values being sent from some of the client Roku boxes. These values are outside the range of -720 to +720 (12 hours). The timeZoneOffset is calculated as follows
nowDate = CreateObject("roDateTime")
UTCDateHour = nowDate.getHours()
nowDate.toLocalTime()
localDateHour = nowDate.getHours()
timeZoneOffset = (UTCDateHour - localDateHour) * 60

I've tested the above code on my local Roku box with all different time zone settings and the above function seems to be working correctly. I was wondering if the above issue was because the client has not set the time on their Roku boxes. Does the Roku box automatically set the timezone correctly or should this be done by the client specifically? If the client does not set the time, what is the default value set on the Roku box?

Thanks
0 Kudos
2 REPLIES 2
RokuJoel
Binge Watcher

Re: wrong values for timeZoneOffset

Hi, the user sets the time zone when they set up the device the first time. Relocating the device to another time zone or choosing the incorrect one during setup might cause it provide inaccurate data. I believe devices default to Eastern Standard Time, at least when configured in North America.

- Joel
0 Kudos
EnTerr
Roku Guru

Re: wrong values for timeZoneOffset

The reason you are getting time difference outside of [-12, +12] is that toLocalTime() conversion may cross midnight back or forth, i.e. into the next or previous day. So you easily get difference swinging [-23, +23].
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.