I need to use "real time" for my project, how can I use it in uipath?

I have a project that have to read the “time” in desktop and use it in my project, and currently I am not quite understand how to deal with it

For example
A function in website is only available for three hours from now

What I want is
Current time in desktop(for example): 8:00 AM

Verify the time written in excel sheets (for example):9:00 AM
Type it in the website function

(for example): 11:45 AM
Skip it, Continue to next step

The question is how can I read the time from desktop? use what code? or UIPATH has function to deal with it?

Use dotnet method… DateTime.Now() this would give current system time

But how can I convert this value into string and output it?

Hi @mightsuccess
You can Use DateTime.Now.ToShortTimeString It will give you only the Time In string.
Thanks & Regards


Thanks that is really helps
Last question, is there any way to compare it?
for example 9:00AM compare 8:00AM current time (within 3 hours)
keep it
11:45AM compare 8:00AM current time (not in 3 hours)
skip it

Store current Date in one variable and Second one in another one then Use the “If” Activity to Check It. If these are the same then do your work in the then Section.
Thanks & Regards

my logic is
(for example) current time is 8:00 AM, amount in excel spreadsheet is 9:00AM

If 8:00 AM<9:00AM<11:00AM
Then start the project
The problem is I don’t know how to add 3 hours in a string value, and the compare symbol “<” is not available for string
Do I need to create a new datatime variable to do this or there is a vb.net express to do it?

Hi @mightsuccess
Whether the format of The time you are getting From the spreadsheet And the time you are getting from DateTime.Now.ToShortTimeString is same or different? if same then get the value from the spreadsheet store it in variable and compare the variable of current time with the spreadsheet time variable if these two match then do your project in the then section. just like
CurrentTime Var = SpredSheetTime var.
Thanks & Regards


For comparision and add hours in time you need to convert the string in DateTime

for example - Convert.ToDateTime(time string varaiable).Addhours(3) to add hours same for comparision you need to convert the sting into date for do the cmoparision


An error run out when I compare three datetime variables
It says operator “<” is not defined for “Boolean” and “Date”

I have multiple amounts of “time” written in excel for comparison
I’m using for each and if condition to check whether if it is available
All of them are string
The problem is I have to deal with all of them which lie in intervals of 8:00 AM to 11:00AM and take all of them out
but not simply equal to current time 8:00AM

You have to do the whole process in loop

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