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: 
TheEndless
Level 10

Are date strings localized on non-US Rokus?

I have code in a few channels that uses roDateTime.GetWeekday() to determine the day of the week. Since that method returns a string, I'm concerned that that code will break if the language is set to anything other than English. Testing on my US Roku, GetWeekday() looks to return in English regardless of language setting, but is that true for all Rokus, or only US units? Also, is that likely to change at any point?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
4 REPLIES 4
RokuKevin
Level 9

Re: Are date strings localized on non-US Rokus?

This is currently true for all Rokus. We return the US English date strings for GetWeekday() on all Rokus regardless of region or locale.

I would not plan on this always being true. We will at some point modify GetWeekday() to return locale specific strings.

--Kevin
0 Kudos
MSGreg
Level 7

Re: Are date strings localized on non-US Rokus?

Then perhaps you can also include GetWeekDayInteger() to return a numeric indication of the week day?
0 Kudos
RokuKevin
Level 9

Re: Are date strings localized on non-US Rokus?

MSGreg,

Yes, you can anticipate a GetWeekDayInteger() method in the future as well.

--Kevin
0 Kudos
TheEndless
Level 10

Re: Are date strings localized on non-US Rokus?

"MSGreg" wrote:
Then perhaps you can also include GetWeekDayInteger() to return a numeric indication of the week day?

Until then, this function will calculate it as an integer:
' 0=Sunday
Function GetDayOfWeek(date As Object) As Integer
daysFromEpoch = Int(date.AsSeconds() / 86400) + 1
day = (daysFromEpoch Mod 7) - 4 'epoch is a Thursday (4)
If day < 0 Then
day = day + 7
End If
Return day
End Function

It'd also be really nice to have a way to determine the current timezone offset for a given timezone, adjusting for DST. I have a need at the moment to convert all times to a specific timezone, but adjusting for DST has proven to be horribly complicated, particularly on the days that DST starts and ends.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos