How to read a different date format and write the output in a different format?

Hi all,

Having trouble with writing out the format I desire

For example read 01-May and write it as 20210501

Whenever I read it and attempt to write it as yyyyMMdd the output is always crossed out…

have a look on following sample
grafik

we assumed that all dates are from this year
Check your data if MMM or MMMM is needed, we cannot derrive from May Month
Ensure following:
grafik

Hi and thanks for your response!

How do I change and write range all the dates from a datatable variable to what you mentioned above?

I tried out
DateTime.ParseExact(DT&DateTime.Now.Year.ToString,“dd-MMMyyyy”,CultureInfo.InvariantCulture).ToString(“yyyyMMdd”)

but an error saying Operator & cant be mixed with datatable or method group

@lmoham,

You will need to iterate over datatable that you have using for each row activity like below,

for earch row in datatable {
// then take write cell activity.
//take assign to get value of row
strValue = row(“columnName”).tostring
//convert strValue suing @ppr’s code.
//provide strValue to cell
}

Cheers,
Pankaj

Thanks for your reply Pankaj, sorry but this got me more confused.
Tried replicating what you said but am not sure how to implement it into my original problem…

I start with reading the entirety of the desired sheet which contains the format for some columns in the form of dd-MMM
image

next I try to filter out columns that arent the dates but it just comes across as crosses
image

also cant share the files used as its work related

@lmoham,

yeah, understand, it’s confidential file.

could you make sample file for me? will make example in uipath.

Cheers,
Pankaj

Hi Pankaj,

here is the sample file

dummy.xlsx (8.5 KB)

@lmoham,

I missed to tell on above point, you just increase column width go to home => format => column width, hash symbols will appear and column name will be visible.

thanks for sharing file, will try it.

Cheers,
Pankaj