Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dan19
Level 9

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.

View solution in original post