Hello,
I’m working on an app where I want to compare a list of time’s to the current time and set a value if the time is within the range.
I’m current storing the times in a preference file on OS X and reading them when the app launches. I’m using the MBS plugins for CFPreference calls. I currently have the times stored in an array in a plist:
exceptiontimes
06:30-07:30
09:30-10:30
15:30-16:30
19:30-20:30
00:00-00:30
I want to check the current time and set the variable ‘App.ContinueThread = true’ if the current time is within the range of those times.
I’ve created an array of the times from the plist and currently just have this code to determine the current hour/minute:
Dim today As New Date()
Dim currentHour As String = Format(today.Hour, “00”)
Dim currentMinute As String = Format(today.Minute, “00”)
This provides me with a nicely formatted time like so: “15:11”
I’m looking for advice on how to compare the current time to the time ranges in the array. I suspect I’ll need to loop through all the ranges, splitting the beginning and ending times, then comparing them to the current time.
What’s the best way to handle this? I’m also willing to look at different ways to store the exception time ranges if that helps.
Thanks!