iOS Question Timeparse

innoApp

Member
Licensed User
In B4A, I use this code:

B4X:
Dim StartTime As Long
    Dim EndTime As Long
    DateTime.TimeFormat ="HH:mm:ss"
    StartTime = DateTime.TimeParse("13:00:00")
    EndTime = DateTime.TimeParse("14:00:00")

In B4i there is no DateTime.TimeParse command.
How can I achieve the same result. My goal is to check whether a time falls within a certain range
 

emexes

Expert
Licensed User
B4X:
StartTime = DateTime.TimeParse("13:00:00")
EndTime = DateTime.TimeParse("14:00:00")

How can I achieve the same result. My goal is to check whether a time falls within a certain range

If all your times are in the 24-hour three-lots-of-two-digits format that you've indicated, then you can just compare them as strings, no parsing required.

And if the range crosses midnight but you think and program carefully, it works even then. ?
 
Upvote 0
Top