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: 
Nerdtron
Binge Watcher

working with datetime and time zones

I need to get the current time on the Roku device in my channel code and convert it to EDT or EST time zone (https://en.wikipedia.org/wiki/Eastern_Time_Zone) depending on whether daylight savings is currently active based on the date.

I found ifDateTime (https://developer.roku.com/docs/references/brightscript/interfaces/ifdatetime.md) which appears to provide the basic functionality I would need.  I can get the current time, then call GetTimeZoneOffset() to convert to either EDT (UTC-4) or EST (UTC-5).  I would of course need to check the current date to see whether to use EDT or EST.

The goal is to determine the current time in EDT or EST depending on the date when watching a live event.  The live event occurs in those time zones which is why the time conversion is important.

Is there a simpler way to do this than what I've described?  Has anyone else worked through this and come up with a good approach?

0 Kudos