Forum Discussion

dan19's avatar
dan19
Binge Watcher
5 years ago
Solved

Get current roDateTime based on a give timezone

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.

  • 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.

     

1 Reply

  • renojim's avatar
    renojim
    Community Streaming Expert

    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.