I have an app where the time is selected using the time dialog.
My Code:
This code works but I don't understand why.
The value of td.Hour after selecting is correct but the value in TimeSet is one hour later???? This only seems to affect the hour, the minutes are correct. Adding the '-1' to td.Hour corrects this problem.
Can anyone tell me why this is required or have I made a mistake? Many Thanks.
Mark.
My Code:
B4X:
Sub GetTime(hh As Int, mm As Int)
td.Is24Hours=True
td.Hour=hh
td.Minute=mm
If td.Show("Select time", "", "Ok", "Cancel", "", Null) = DialogResponse.POSITIVE Then
TimeSet =(td.Hour-1) * DateTime.TicksPerHour + td.Minute * DateTime.TicksPerMinute
Log(td.Hour)
Log(DateTime.Time(TimeSet))
End If
End Sub
This code works but I don't understand why.
The value of td.Hour after selecting is correct but the value in TimeSet is one hour later???? This only seems to affect the hour, the minutes are correct. Adding the '-1' to td.Hour corrects this problem.
Can anyone tell me why this is required or have I made a mistake? Many Thanks.
Mark.