ERROR: Assign: Conversion from string "16/03/2020" to type 'Date' is not valid

Hi all,

I am getting this error when i try to convert to date format.

Here is my aktivities and error:

1.datestring: rows.Item(“Date”).ToString

2.date_date: Convert.ToDateTime(datestring)

3.date_date.ToString(“yyyy-dd-MM”)

Hi,

Can you try the following expression instead of Convert.ToDateTime.

Datetime.ParseExact("16/03/2020","dd/MM/yyyy",nothing)

Regards,

1 Like

@mazlumkacar “dd/MM/yyy” give like this

1 Like

Hi,
Did you ever manage to format your string to dd/mm/yyyy? I have had a nightmare today with the same issue, no matter what I try, my output is in US format MM/dd/yyyy :sob:

Hi from excel while trying to output the date it will always come in format MM/dd/yyyy

So to prevent that while reading the excel file, tick the preserve format option in read range. it will preseve as in excel file while outputing

Regards

Nived N

Happy Automation

Hi @ZoeW ,

You can try this…

Assign ACtivity
Var=DateTimeVariable.tostring(dd/MM/yyyy)