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

Get current roDateTime based on a give timezone

Jump to solution

Hello,

I am trying to get the current time of a certain place (not my roku device time), based on the given timezone.

For example, if I have a timezone of -25200, how do I get the roDateTime of this location?

I have seen JS methods for doing this, and I was wondering if it doable in BRS.

 

Thanks.

0 Kudos
1 Solution

Accepted Solutions
renojim
Community Streaming Expert

Re: Get current roDateTime based on a give timezone

Jump to solution

For the current time:

t = CreateObject("roDateTime")
t.fromSeconds(t.asSeconds()-25200)

For some other time replace t.asSeconds() with the GMT time in seconds (from epoch - 1/1/1970) you want to convert to another timezone.

 

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.

View solution in original post

1 REPLY 1
renojim
Community Streaming Expert

Re: Get current roDateTime based on a give timezone

Jump to solution

For the current time:

t = CreateObject("roDateTime")
t.fromSeconds(t.asSeconds()-25200)

For some other time replace t.asSeconds() with the GMT time in seconds (from epoch - 1/1/1970) you want to convert to another timezone.

 

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
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.