Hi,
I'm trying to work out how to change timezones with code like:
The problem is this generates a log of:
Can anyone enlighten me?
Thanks...
I'm trying to work out how to change timezones with code like:
B4X:
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 8
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private xui As XUI
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
Dim no As NativeObject
no.Initialize("NSTimeZone")
Dim orig_timeZone As Object = no.RunMethod("defaultTimeZone", Null)
Log(orig_timeZone)
Log(DateTime.TimeZoneOffset)
Dim no As NativeObject
no.Initialize("NSTimeZone")
no.RunMethod("setDefaultTimeZone:", Array(no.RunMethod("timeZoneWithName:", Array("GMT"))))
Dim no As NativeObject
no.Initialize("NSTimeZone")
Dim orig_timeZone As Object = no.RunMethod("defaultTimeZone", Null)
Log(orig_timeZone)
Log(DateTime.TimeZoneOffset) '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Dim no As NativeObject
no.Initialize("NSTimeZone")
no.RunMethod("setDefaultTimeZone:", Array(no.RunMethod("systemTimeZone", Null)))
Dim no As NativeObject
no.Initialize("NSTimeZone")
Dim orig_timeZone As Object = no.RunMethod("defaultTimeZone", Null)
Log(orig_timeZone)
Log(DateTime.TimeZoneOffset)
End Sub
The problem is this generates a log of:
I would have thought the line I have highlit with <<<<<<<<<<< would read "0"Application_Start
Australia/Sydney (AEST) offset 36000
10
GMT (GMT) offset 0
10 <<<<<<<<<<<<<<<<<<<<<<<<<<<<
Australia/Sydney (AEST) offset 36000
10
Application_Active
Application_Inactive
Can anyone enlighten me?
Thanks...
Last edited: