Check If Current Time < Fixed Time Variable?

Hi all,

I want to check if the current time is less than a fixed time, then perform an action. But I’m having some trouble establishing my variables to compare.

Here is what I’m trying to get:

If the current time (in format hh:mm: tt) < 12:05 PM…then perform action A. Else perform action B.

I don’t want the month/day/year, only the hh:mm: tt.


Hey Luecke.

Assign your two input variables (or take them from whatever your input source is):
strNow = datetime.Now.ToString(“hh:mm”)
strFixed = “00:55”

where the latter is your fixed time.

Then you make an if with the following condition:
“datetime.ParseExact(strNow, “hh:mm”, system.Globalization.CultureInfo.InvariantCulture) < datetime.ParseExact(strFixed, “hh:mm”, system.Globalization.CultureInfo.InvariantCulture)”

I’ve attached the workflow for you. Have a good day :slight_smile:

Main.xaml (4.4 KB)

I made a video tutorial about dates and times (datetime) in UiPath. Maybe you can use that for further reference:


Thank you @AndersJensen!

Also a big fan of your videos, I subscribe and have watched quite a few of them. Appreciate the help!

1 Like

Wow, thank you Luecke :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.