I innoApp Member Licensed User Nov 7, 2023 #1 In B4A, I use this code: B4X: Copy 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
In B4A, I use this code: B4X: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Nov 9, 2023 #2 There are inherent problems with TimeParse and that's why it wasn't added in B4i. Mainly related to the days where the time zone changes. You should use DateTime.DateTimeParse instead. You can use DateTime.Date(DateTime.Now) for the date part. Upvote 0
There are inherent problems with TimeParse and that's why it wasn't added in B4i. Mainly related to the days where the time zone changes. You should use DateTime.DateTimeParse instead. You can use DateTime.Date(DateTime.Now) for the date part.
E emexes Expert Licensed User Longtime User Nov 10, 2023 #4 innoApp said: B4X: Copy 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 Click to expand... 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
innoApp said: B4X: Copy 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 Click to expand... 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. ?