Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
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?
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.
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].