If your closing hour is lower than your opening hour, you will need another logic with two separated searches:
Search 1:
- Open_hour_number < Current Date/Time:Extrat Hours*60 + Current Date/Time:Extrat Minutes
- Close_hour_number < Current Date/Time:Extrat Hours*60 + Current Date/Time:Extrat Minutes
Search 2:
- Open_hour_number > Current Date/Time:Extrat Hours*60 + Current Date/Time:Extrat Minutes
- Close_hour_number > Current Date/Time:Extrat Hours*60 + Current Date/Time:Extrat Minutes
Search1:count + Search2:count
If the COUNT of both searches, summed, is >0 then your store is open.
In your example:
Current time = 7pm = 19:00 = 19 * 60 = 1140
Opening hour = 5pm = 17:00 = 17 * 60 = 1020
Closing hour = 2am = 2:00 = 2 * 60 = 120
Search 1 count is 1
Search 2 count is 0
Store is OPEN
Current time = 1am = 01:00 = 1 * 60 = 60
Opening hour = 5pm = 17:00 = 17 * 60 = 1020
Closing hour = 2am = 2:00 = 2 * 60 = 120
Search 1 count is 0
Search 2 count is 1
Store is OPEN
Current time = 3pm = 15:00 = 15 * 60 = 900
Opening hour = 5pm = 17:00 = 17 * 60 = 1020
Closing hour = 2am = 2:00 = 2 * 60 = 120
Search 1 count is 0
Search 2 count is 0
Store is CLOSED
Hope it helps!