Forum Discussion

TheEndless's avatar
TheEndless
Channel Surfer
13 years ago

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?

4 Replies

  • 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
  • Then perhaps you can also include GetWeekDayInteger() to return a numeric indication of the week day?
  • MSGreg,

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

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