iOS Question Set TimeZone

Discussion in 'iOS Questions' started by MotoMusher, Feb 15, 2015.

  1. MotoMusher

    MotoMusher Active Member Licensed User

    Working on Moving a B4A app to B4i.

    I was using reflector to set the timezone in B4A:
    Public Sub SetTimeZone(id As String)
    Dim r As Reflector
    ' Dim r As NativeObject
       Dim idTz As Object = r.RunStaticMethod("java.util.TimeZone""getTimeZone"Array As String(id), _
    Array As String("java.lang.String"))
    "anywheresoftware.b4a.keywords.DateTime""setTimeZoneInternal", _
    Array As Object(idTz), Array As String("java.util.TimeZone"))
    End Sub
    Is there a better way to do this in B4i?
  2. Erel

    Erel Administrator Staff Member Licensed User

    What exactly are you trying to do? Why do you need to change the time zone?
  3. MotoMusher

    MotoMusher Active Member Licensed User

    My existing B4A app creates an encoded token based on US Pacific time, which has to match functionality of an existing website/internal applications which I was asked to duplicate in apps. I can do settimezone -8 with b4i, but that doesn't account for dst.

    I can hardcode around dates, at least for now if there is no equivalent. B4a solution was elegant.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.RootPanel.Color = 
    End Sub

    Sub SetTimeZone(id As String)
    Dim no As NativeObject
    "setDefaultTimeZone:", _
    End Sub

    Sub PrintKnownTimeZones
    Dim no As NativeObject
    Dim timeZones As List = no.RunMethod("knownTimeZoneNames"Null)
    For Each s As String In timeZones
    End Sub
    MotoMusher likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice