M maasdoel New Member Licensed User Longtime User Feb 14, 2013 #1 I am in TZ +2 (Bravo) StartTime gets set in Activity_Create within a FirstTime only section B4X: StartTime=DateTime.Now The following lines of code produces an 2Hr+x interval B4X: Sub Timer1_tick() lblTime.Text=DateTime.time(DateTime.now) lblInterval.Text=DateTime.Time(DateTime.Now-StartTime) End Sub This second set produces the correct interval B4X: lblTime.Text=DateTime.time(DateTime.now) lblInterval.Text=DateTime.Time((DateTime.Now- StartTime)-(DateTime.GetTimeZoneOffsetAt(DateTime.Now)*DateTime.TicksPerHour)) Seems odd that my T.Zone is used correctly with lblTime1 but not with lblInterval (Running on Nexus 7) http://www.b4x.com/forum/images/smilies/sign0104.gif Regards Eric
I am in TZ +2 (Bravo) StartTime gets set in Activity_Create within a FirstTime only section B4X: StartTime=DateTime.Now The following lines of code produces an 2Hr+x interval B4X: Sub Timer1_tick() lblTime.Text=DateTime.time(DateTime.now) lblInterval.Text=DateTime.Time(DateTime.Now-StartTime) End Sub This second set produces the correct interval B4X: lblTime.Text=DateTime.time(DateTime.now) lblInterval.Text=DateTime.Time((DateTime.Now- StartTime)-(DateTime.GetTimeZoneOffsetAt(DateTime.Now)*DateTime.TicksPerHour)) Seems odd that my T.Zone is used correctly with lblTime1 but not with lblInterval (Running on Nexus 7) http://www.b4x.com/forum/images/smilies/sign0104.gif Regards Eric
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2013 #2 You should use the new DateUtils module to calculate the period between two dates. Upvote 0