Botter
(Botter)
1
Hi, I guess this is a very simple ting, but I still manage to get stuck. In col 0 in a datatable, each row has a string similar to this:
Tuesday, 14-MAY-2022 (All text)
I need to delete everything before the date part, and then convert the text formatted date to a real date.
Anyone?
Gokul001
(Gokul Balaji)
2
Hi @Botter
You can try with Regex expression
System.Text.RegularExpressions.Regex.Match(Currentrow("ColumnName").Tostring,"\d{2}-\S.*-\d{4}").Tostring
Check out this tutorial and thread for chamging the date format in excel file
Regards
Gokul
Hi @Botter ,
Can you try this,
str = Tuesday, 14-MAY-2022
dateTimeVar = DateTime.ParseExact(str.Split(","c)(1),“dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture)
Gokul001
(Gokul Balaji)
4
Hi @Botter
Alternative Method, It will gives you only the date.
DateTime.ParseExact(Currentrow("ColumnName").Tostring,"dddd, dd-MMM-yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MM-yyyy")
Regards
Gokul
Botter
(Botter)
5
And this I should use in a “For Each Row In Data Table” activity?
Gokul001
(Gokul Balaji)
6
Yes, You need to use For each row in Data Table activity
Botter
(Botter)
7
OK, thank you very much for your time and sharing your knowledge all of you!