Change format date excel

Dear all,

I want to change format date to dd/mm/yyyy HH:MM:SS in column Planned Start

image

Please guide me for solve it.

Thank you

@Stef_99 ,
From which format you want to change to dd/MM/yyyy HH:MM:SS format?

Regards,

Hi @Stef_99

Try this:
CurrentRow("Planned Start") = DateTime.ParseExact(CurrentRow("Planned Start").ToString,{"MM/dd/yyyy HH:mm:ss","M/d/yyyy HH:mm"},System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy HH:mm:ss")

Hope it helps!!

1 Like

@Jithesh_R In column Planned Start some row have format dd/mm/yyyy HH:MM:SS and some row have format d/m/yyyy HH:MM

@Parvathy use loop by row right?

If I want to convert all row in column (except header) and write in same row

Please guide me for solve it.

Hi,

How about FormatCells activity?

image

https://docs.uipath.com/activities/other/latest/productivity/format-range-x

Regards,

1 Like

Hi @Stef_99

=> Read Range Workbook
Output → dt

=> For Each Row in DataTable dt
Assign:
CurrentRow("Planned Start") = DateTime.ParseExact(CurrentRow("Planned Start").ToString,{"dd/MM/yyyy HH:mm:ss","d/M/yyyy HH:mm"},System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy HH:mm:ss")

=> Write Range Workbook dt back to excel. Enable Add Headers option.

In the mean while share the excel, I will help you with flow.

Regards

Hi @Stef_99

@AJ_Ask @Yoichi I follow your suggest.
But not change format.

File excel as attached.

input.xlsx (11.4 KB)

Hi @Stef_99

=> Read Range Workbook.
Output → dt

=> For Each Row in DataTable dt
Assign:
CurrentRow("Planned Start") = DateTime.ParseExact(CurrentRow("Planned Start").ToString,{"dd/MM/yyyy HH:mm:ss","d/M/yyyy HH:mm"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd/MM/yyyy HH:mm:ss")

=> Write Range Workbook dt back to excel. Enable Add Headers option.

Output:

Regards

1 Like

Hi,

It seems already set as Text. So it’s necessary to re-input data as DateTime as the following.

Regards,

1 Like

@Yoichi Can don’t fix F17 (don’t fix row) because sometime have row and not row 17?

@Parvathy Why output have same data not change format.
But after run If I click in cell and enter format have change.

image

Can you guide me for solve it.

Hi @Stef_99

Output:

It is changing check the last row once.

Regards

@Parvathy I got your point.

But I run code follow your suggest but not change.
But It I click in cell and click enter it change format.

Hi @Stef_99

Can you share your flow once.

Regards

@Parvathy Now I found cause.

Thank you for your support.

1 Like

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