How to compare time lies within given timeslot regardless of date



I want to check whether current time lies between given time slot regardless of date.
I have a service that user can configure to run during “off-peak” hours. They have the ability to set the time frame that the service can run.

For Example:

User A works 8am-5pm, so they want to schedule the app to run between 5:30pm and 7:30am.

User B works 9pm-6am, so they schedule the app to run between 6:30am and 8:30 pm.

The point is that the app uses their computer while they are not.

Given a DateTime of the current time, a DateTime of the start and a DateTime of the stop time, how can I check if current is between start and stop.

The tricky part for me is that the time can cross the midnight boundary.



If you have a solution please let me know


here is an workflow cheers…!
check time period.xaml (11.1 KB)

input: start Time

  1. Start Time
  2. End Time


  1. Flag


How to keep UiPath running in the background, or start automatically/scheduled time?

Thanks :smiley: :smiley: