Extract date from excel and change format

I am trying to extract a date from excel data but it returns time with zeros like this 7/16/2021 00:00:00 how to remove zero and how to reformat date in this form yyyy-mm-dd

Hi @Mohamed_Hassan1

once after reading datatable pass that dt to FOR EACH ROW activity as input and inside the loop use a assign activity like this

row(“column name of date”) = Datetime.ParseExact(row(“Column name of date”).ToString.SubString(0,10).ToString.Trim,“MM/dd/yyyy”,system.Globalization.CultureInfo.InvariantCulture).tostring(“yyyy-MM-dd”)

or

simply try with same assign activity but with different expression like this

row(“Column name of date”) = Convert.ToDatetime(CurrentRow(“Column name of date”)).ToString(“yyyy-MM-dd”)

Hope this would help you

Cheers

HI @Mohamed_Hassan1

is the issue resolved.

Hi @Mohamed_Hassan1

After extracting the date are you writing it in another excel file and is it showing zeros there?

Suggestion - Use Excel Scope Activity for reading (Read Range) and writing (Write Range Acitivity) the excel files and not the Workbook activities.

image

image

image

@Mohamed_Hassan1

Check below for your reference

Reference

Hope this may help you

Thanks