How to split the date of string format DD.MM.YYYY to another column just like below? I know how to do it using for each activity but I prefer Linq solution as it contains 10k rows. The Month and Year column is pre-created.
Can you try the following InvokeCode activity?
dt.AsEnumerable.ToList.ForEach( Sub(r) r("Month")=r("Date").ToString.Split("."c)(1) r("Year")=r("Date").ToString.Split("."c)(2) End Sub )
Hi @arina ,
Maybe we could try with the help of Data Column Expression in the below way :
Expression used :
DT1.Columns("Month").Expression = "SUBSTRING(CONVERT([Date],System.String),1,2)" DT1.Columns("Year").Expression = "SUBSTRING(CONVERT([Date],System.String),7,4)"
The Expression converts the Date value to a String format and we can then apply the substring function on the data.
Do check your date format output in the Debug Panel, you would need to apply the Start and Count of Substring accordingly to fetch the Month and the Year.
More on Data Column Expression below :
Agreeing to @supermanPunch have a look here, where we presented different options. The datacolumn.Expression option was mentioned as well
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.