I'm writing a VB console program that will run a function at a certain time of day. This is what i have so far.
Sub Main()
    Do
    Dim backupTime As String
    backupTime = My.Settings.backupTime
    While TimeOfDay = backupTime
        Threading.Thread.Sleep(2000)
    End While
    backup()
  loop
End Sub
The "backupTime" that is being referred to is stored in the App.Config file
<userSettings>
    <ZipAJob_Timed.My.MySettings>
        <setting name="backupTime" serializeAs="String">
            <value>#01:59:00 PM#</value>
        </setting>
    </ZipAJob_Timed.My.MySettings>
</userSettings>
The problem is that the "Do While" loop checks every 2 seconds for the "TimeofDay" to match "backupTime". But that can lead to the program not running because it missed the match by 2 seconds. So either i need to have it disregard the seconds or to have the TimeofDay.minutes/hours and backupTime.minutes/hours match only.
I've looked into Parsing..but not exactly sure where i should start.