While Working on Excel Sheet I am getting time also along with Date , How to remove it?


Find the Workflow:
Main.xaml (8.7 KB)

1 Like

Thank you @Vaibhav_Rajpoot_17 .

It works perfectly . Have a nice day.


mark as solution if your problem is solved .

1 Like

The solution is just for one column
Assign: Conversion from string “” to type ‘Date’ is not valid.
I am getting error for this also
What to do??

Test.xlsx (9.3 KB)
Here is the file that I am uploading it .
It contains data in 3 columns for date where 2 columns contain date and time and 1 column contain only date.
And 1 column is empty which will also filled with date at due process.
Check this sheet and if you can help me the solution for this, it would be a great help

Find the Workflow:
Main.xaml (9.8 KB)

@Kunal_Jain ,
The Component suggested is able to perform only one Column Conversion at a Time. But even with that if you do receive errors when the value is Empty, then maybe we would require to perform a Modification on the component.

However, do Check if there are other such Components in the Marketplace which would do the Conversion for Multiple Columns at the same time. Below is the Marketplace link :

In the meantime, Check if the below Solution works, which also is able to convert Multiple Date Columns into a Required Specific String date format.

Change_DateTimeFormatString_ForMultipleColumns.zip (10.0 KB)

It is again showing the error on passing activity after adding trim activity
I have just edited the assign activity
(From x In DT
Let ra = DT.Columns.cast(Of DataColumn).Select(Function(c)If(columnNames.Contains(c.ColumnName) AndAlso Not(String.IsNullOrWhiteSpace(x(c.ColumnName).ToString.Trim)),DateTime.ParseExact(x(c.ColumnName).ToString.Trim,dateFormats,System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString(RequiredDateFormat),x(c.ColumnName).ToString.Trim)).ToArray
Select OutputDT.Rows.Add(ra)).CopyToDatatable
and than also it is showing Assign: String was not recognized as a valid DateTime. this error
I have attached the image of the error

Please provide the solution

Quite complex with datetime functions.
Recently did the following solution:

split the string(time span) by blank space and get first element e.g. strTime.split(" "c)(0).

@Kunal_Jain , For the Test file provided, it did not give out any error at my end.

Could you maybe Inspect the values present in the Datatable either by using Debug / Write Line Activity to confirm the Date Formats used.

Status_Report.xlsx (24.9 KB)
Could you please try on this sheet
This sheet contain complete data of date and time
The error is in OutputDT Assign variable only

@Kunal_Jain ,

We see that there is an Invalid value present in the Columns of this sheet :

What do you want to do in this case ?

This must be replicated as it is
means the data other than date must be replicated same as it is
For all the columns

@Kunal_Jain ,
Check the Updated Workflow Below :
Change_DateTimeFormatString_ForMultipleColumns.zip (25.2 KB)

1 Like

Yes This worked
Thank you

1 Like

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