Date conversion error coming while processing

Hi everyone I’m working on a some excel activities in that i have one date column when i try to convert that into specific format it is throwing error. Firstly I’m getting some data in excel i want to update that on web browser page in that date field i need to split it like day, month and year, I need to write in my browser filed but here my bot is throwing error that it is not a correct format I’m attaching the screenshots also.


This is my actual excel date format

My code


My bot is throwing error in convertion part

@ranaprathap928

Check below for your reference

If date is returning as number, then check below for your reference

Hope this helps you

Thanks

Hi @ranaprathap928

You can try these option

  1. Check the preserve format option in read range

And then try

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

Hi @NIVED_NAMBIAR i tried that it is not working

@NIVED_NAMBIAR I’m getting this error in production when i test in normal flow it’s working. I need to some different code for coversion of date

are u getting error when u are using substring approach @ranaprathap928

@NIVED_NAMBIAR I’m getting error here

Converted date (assign activity)

is ExcelDate is string ?

Yes @NIVED_NAMBIAR

@NIVED_NAMBIAR

This type error I’m getting in Converted date (assign activity)

Hi @ranaprathap928

so it implies that u are getting error for this date with format of dd-MM-yyyy only ?

is it right buddy?

Yes @NIVED_NAMBIAR few getting similar formats and few are getting different formats, that’s y i used this convertion activity there

Hi @ranaprathap928

I think u can refer this how you can convert multiple dates format into single one

Regards,

Nived N

Happy Automation

Thanks @NIVED_NAMBIAR i will check this

1 Like

@NIVED_NAMBIAR that is C# code I’m looking for any normal code, which can be understand easily.

Hi @ranaprathap928

Using assign activitiy

First create a string array

arr= {“MM/dd/yyyy”,“yyyy-MM-dd”}

Now use the below Assign activitiy

date_1= DateTime.ParseExact(strDate, arr, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

Ok @NIVED_NAMBIAR i will check this

1 Like

@ranaprathap928

Try below once
Just pass your date variable instead of date
DateTime.ParseExact(“02/27/2021”,“MM/dd/yyyy”, system.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

@NIVED_NAMBIAR

@Pravin_Patil1 i will check this