Datetime parse issue if the date is 0x/0x/xxxx (both dd and MM is paired with a 0)

if the date in excel is e.g: 29/01/1951, UiPath will read it as 01/29/1951 00:00:00
then when go through this coding, it will become 29/01/1951
and that is indeed what i intended or.

if the date in excel is e.g: 08/09/1984, UiPath will read it as 08/09/1984 00:00:00
then when go through this coding, it will become 09/08/1984.
differ from what i want, supposed to be 08/09/1984

the coding is DateTime.Parse(row(Config(“BirthDay”).ToString).ToString.Trim).ToString(“dd/MM/yyyy”)

the issue is when date is 0x/0x/xxxx, im not sure how to fix or overcome this.
the format in excel is in date format.

Regards,
Hanaz

HI,

Basically, data that is in date format in an Excel cell can be read correctly in DateTime type in UiPath.
So, can you share your Excel file? It’s no problem if dummy data.

Regards,

Dummy Example.xlsx (9.0 KB)
Is this file okay? The actual file have too much private information so this is the related column.

Thank you for responding.

Regards,
Hanaz

HI,

In this case, data excep No1 is not recognized as DateTime in Excel.
(In my environment, as locale settings is Japanese, default date style is yyyy/M/d and No1 is displayed as it. It may be different with your environment)

image

So, perhaps we need check it’s datetime or not, and if not ,it’s necessary to convert it using DateTime.ParseExact. Can you try the following sample?

Sample
Sample20240724-1.zip (9.9 KB)

Regards,

1 Like

Yesterday, I tested with several rows of data and its the same as what I described above.
but today, i tested with a new date of 07/01/1952 and UiPath read it as 01/07/1952 00:00:00 and returns it as 07/01/1952.

Does this mean that the issue is within excel formatting?

edit: I just received your reply, I will read it first.

Hi Yoichi,

I have observed that the issue is indeed related to Excel formatting.
Unable to access your zip file as it got blocked in company’s laptop, but your response helped me in understanding the initial issue.
Thank you for your time.

Regards,
Hanaz

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