Android Question Can I compare time values with a "Between" keyword?

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I set up a screen where the user can set a silent period "From" and "To" to make sure sound files are not played during the time range the user selected.

I have started this coding:

B4X:
Sub whlTime_Closed(Canceld As Boolean, Time As String)

    If Canceld = False Then
        Select StrButtonTapped
  
            Case "ButtonSilentPeriod1StartPicker"
                LabelSilentPeriod1Start.Text = "From:" & Chr(10) & Time
                lngSilencePeriod1FromTime = Time
      
            Case "ButtonSilentPeriod1EndPicker"
                LabelSilentPeriod1End.Text = "To:" & Chr(10) & Time
                lngSilencePeriod1ToTime = Time
        End Select
    End If
End Sub

B4X:
Dim lngTheCurrentDateTime As Long
lngTheCurrentDateTime = DateTime.Now

Does Basic4Android have a function that I can use to test if lngTheCurrentDateTime is between lngSilencePeriod1FromTime and lngSilencePeriod1ToTime ?

Sometimes the user may need to enter a "From" time as 20:30 and a "To" time as 7:00 that represents a silent period that goes through the overnight hours.

Please show me coding that I need to implement to test for this.

Thanks.

Truly,
R. Leiman
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top