qafro qafro - 24 days ago 8
Vb.net Question

How to check if a time falls within a specific range on a week day using vb

Please am a newbie in VB,and I will like to know how to check if the output time from another script falls between 2 am and 3 am on a weekday and display 1 if true or 0 if false using VB.

Could someone please help?

Answer Source

Function IsTimeInRange() will return True if current time is in the desired range else False.

Function IsTimeInRange() As Boolean
    Return Now.DayOfWeek >= DayOfWeek.Monday AndAlso
           Now.DayOfWeek <= DayOfWeek.Friday AndAlso
           Now.Hour = 2 'Includes everything between "02:00:00.000 AM" and "02:59:59.999 AM"
End Function