On your form you use an EditText to input time. If you want to calculate with this, may be the following example will help:
For example:
You have a PauseStart and PauseEnd on your form as an EditText. After PauseStart is filled, you want PauseEnd 30 minutes later. You can use above Sub within PauseEnd_FocusChanged.
B4X:
Sub AddTime(OriginalTime As EditText,HoursToAdd As Int,MinutesToAdd As Int,SecondsToAdd As Int) As EditText
Dim Hours As Long
Dim Minutes As Long
Dim Seconds As Long
Dim OldTime As Long
Dim NewTime As EditText
If(OriginalTime.Text <> "") Then
NewTime.Initialize("")
Hours = DateTime.TicksPerHour * HoursToAdd
Minutes = DateTime.TicksPerMinute * MinutesToAdd
Seconds = DateTime.TicksPerSecond * SecondsToAdd
OldTime = DateTime.TimeParse(OriginalTime.Text)
NewTime.Text = DateTime.Time(OldTime+Hours+Minutes+Seconds)
Return NewTime
Else
ToastMessageShow("No time to change",False)
Return OriginalTime
End If
End Sub
For example:
You have a PauseStart and PauseEnd on your form as an EditText. After PauseStart is filled, you want PauseEnd 30 minutes later. You can use above Sub within PauseEnd_FocusChanged.