In our automation processes, we might come across situations where we are required to switch between various workflows based on time.
So how can we do that?
Datetime.Parse(DateTime.Now.ToString(“HH:mm:ss”)) < datetime.Parse(_Time)
Replace the “_Time” with your required “TimeSpan” .i.e 18:00:00, 02:00:00…
Implementation using UiPath :
Let us implement a workflow which compares the current time with the provided time and displays the appropriate messages.
Drag “If” activity into the design panel and populates its condition property with the above-mentioned code with “18:00:00” in it.
Drag “Message Box” activity into the design panel and write “Before 6pm” in it.
Drag “Message Box” activity into the design panel and write “After 6pm” in it.
Based on the current time, we can see the appropriate message.
Click here to download the Source Code…
Hope it has helped you…