Compiler error: Overload resolution failed because no accessible "ToDateTime"

Hi

I have a date on my excel such as 30/03/2019, I read that date and want to write it to another excel.

But everytime I write it, it will be 30/03/2019 00:00:00, I only want the short date type, and the output file may change, so I dont want to set it as short data data format in the excel.

I d like to change the variable to short date in Uipath, so i use this:

acqDate.ToDateTime.ToShortDateString(“dd/MM/yyyy”)

But it report the error, any idea how to solve this?

Thanks

@jingwang0222,

Try like this: row(“DateColumn”).tostring(“dd/MM/yyyy”)

Hi Thanks for your advice
But I already read that data from excel, so it is a variable now,
I try to use variablename.tostring(“dd/MM/yyyy”), the output is the string “dd/MM/yyyy”.

what do you mean by “Datacolumn”, my data table name?

Hi,
you can use DateTime.Parse(yourDate).Date
also you can format your date, DateTime.ParseExact(yourDate, “dd/MM/yyyy”, nothing)
nothing means “use the current culture”

solved!

Hi Jesan
Thanks for your idea, I have solved it from forum’s other question.
I also tried yours, but because my date input is a generic value, the assign error said “string was not recognised as a valid datetime”, I tried to convert it to date time but it still not works.

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