Date Column in Excel based DataTable UiPath

Hi Everyone,

I am having data in excel sheet as shown,

image

Whenever i display this data using data table, it displays column “DOJ” with its date component and time component, However, i want to display only date component in dd/MM/yyyy format, How can i achieve this without using split() method.?

image

Hi @Neal369

Give a try to this
For Each row As datarow In dt_input.Rows
row(“DOJ”)= Date.ParseExact(row(“DOJ”).ToString,“MM/dd/yyyy 00:00:00”,system.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
Next

2 Likes

Hi @Neal369 ,

Try to read your file with Preserve Format enabled as shown in below screenshot,

and let us know.

5 Likes

Hi @Neal369

While reading the DOJ column, the format is getting converted into System.DateTime, so you can convert it into your desired format by using the following function:

`

DateTime.ParseExact(yourDate.ToString,yourDate, Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

`

Output:

Hope this helps,
Best Regards.

2 Likes

May i know where to declare dt_input ?, i have used it as datatable in output of read range activity,

I am getting below error,

Hi @Neal369
Pass the read range output as input to this invoke code arguments.

1 Like

Thank you for reply,

I want to understand expression that you have used in assign activity to assign it to “yourDate” variable in assign activity.

Working Perfect, thank you

1 Like

Perfect, Thank you @Manish540

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