Developers

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?

Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!