Hi
I have an Excel file which contain ALLOTMENTDATE column as it is Date format (04/05/2023) I wish convert this as Text format with a Linq Query to achieve this. Please guide me to resolve this
Input.xlsx (22.5 KB)
Hi
I have an Excel file which contain ALLOTMENTDATE column as it is Date format (04/05/2023) I wish convert this as Text format with a Linq Query to achieve this. Please guide me to resolve this
Input.xlsx (22.5 KB)
input is 08/10/2023 you want output as Sunday October 2023
check the below xaml
dateformat toText.zip (35.5 KB)
cheers
Hi,
Can you share expected output?
FormatCells activity may help you. It can changes format of cells to Text or any datetime style.
Regards,
Cheers
Try this:
DtExcel is input datatable
dtFormatted = (From row In dtExcel.AsEnumerable()
Let dateValue As DateTime = DateTime.ParseExact(row("ALLOTMENTDATE").ToString(), "MM/dd/yyyy", CultureInfo.InvariantCulture)
Let formattedDate As String = dateValue.ToString("dddd MMMM yyyy")
Select dtFormatted.Rows.Add(formattedDate)).CopyToDataTable()
Assign: transformedDataTable = (From row In inputDataTable.AsEnumerable()
Let dateValue = DateTime.ParseExact(row.Field(Of String)("ALLOTMENTDATE"), "MM/dd/yyyy", CultureInfo.InvariantCulture)
Select New Object() {row.Field(Of String)("Column1"), row.Field(Of String)("Column2"), dateValue.ToString("MM/dd/yyyy")}).CopyToDataTable()
In this LINQ query:
inputDataTable
represents the input DataTable containing your Excel data.Column1
and Column2
are placeholders for your actual column names. Replace them with the correct column names from your Excel file.DateTime.ParseExact
to parse the date from the ALLOTMENTDATE column in the “MM/dd/yyyy” format..CopyToDataTable()
to create a new DataTable with the results.Make sure to replace Column1
and Column2
with the actual column names from your Excel file, and adjust the date format string "MM/dd/yyyy"
if your date format is different.
Hope it helps!!
hi- @Yoichi thank you
hi @Parvathy thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.