Convert real number into datetime

Hi here
I have time variable in my excel spreadsheet like 16:34
When I use row().tostring to extract it into string it become 0.78333333…
In next step I use Convert.ToDateTime() get error in it

How can I create a date time variable get from excel spreadsheet?
Thanks

1 Like

If the row is in time format, use the expression like below -
Row().ToString("hh:mm")

An error occur
It written as "disallow implicit conversion from “string” to “integer”

It means, when you read the excel data, the time column is converting to integer.
So, please try to format the column to string in the excel sheet, before reading the excel sheet.

@mightsuccess

Try this:

DateTime.FromOADate(Convert.ToDouble(row(<index/column name>).toString)).toString(“hh:MM”);

Let me know if this works for you.

3 Likes

The format in excel is exactly time not integer
Even I have added a click movement to format it, it is useless
It seems when extract the time to UIPATH it become integer autonomously

An error occur
Comma, ‘)’ and a valid express continuation expected

What are you trying to do exactly because I don’t see this problem on my end? I hope you’re removing the <index/column name> and replacing that with your index or column name value.

@mightsuccess

Hi,

Please find the solution. Forum - DateTime_To_Double_To_DateTime.zip (7.9 KB)

Regards,
Suman

DateTime.FromOADate(Convert.ToDouble(row().toString)).toString(“hh:MM”)

I hope this makes it clearer now. Put the index value or the column name you were going to put inside the row().toString and this shall work.

1 Like


The picture shows it

Is “Time leav” your column name? If yes, put that inside quotes “”

Also, replace “mm:ss” to “hh:MM” if your time is in 24 hour format.

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