How to split “20/10/24 Domestic” to generate only the date
How to split “20/10/24 Domestic” to generate only the date
Is this output of a .tostring on a variable with type datetime or date? If so, use .ToShortDateString()
instead.
str_Input = "20/10/24 Domestic"
str_Output = str_Input.Split(" ").First
Hope it helps!!
Hey @shilpashree.mohanty
try to use
datePart = fullString.Split(" "c)(0)
Try this,
Input string variable = "20/10/24 Domestic"
String output variable = System.Text.RegularExpressions.Regex.Match("your input variable","\d{2}\/\d{2}\/\d{2}").ToString.Trim
output is 20/10/24
Regards,
Gowtham K
if you want just to generate the date as a string you can use split method your expression should be
Str_date = yourOriginalString.split(" "c)(0).tostring
you split by space
add .tostring to convert it
currentrow(0).tostring
@shilpashree.mohanty
maybe you will try
CStr(CurrentRow(0).Split(" "c)(0))
tried but still same
assign variable to the currentrow(0).tostring
then do new assign that splits it
like below
Str_varaibelName = currentRow(0).tostring
Str_varaibelName=Str_varaibelName.split(" "C)(0).tostring
this format is incorrect
Str_varaibelName = Str_varaibelName.Split(" "c)(0).ToString
I tested that , can you copy it and try, the c should be small letter
it should be inside for each row in datatable
the output is coming as system.string
please share screenshots
Fallow the steps below. If I helped you, market it as solved.
To separate the data “20/10/24” from the text “20/10/24 Domestic” in UiPath, you can use the Assign activity to perform the string splitting operation. Here is a simple way to do this:
Step 1
Use an Assign activity to create a variable that contains the original string: originalString = “20/10/24 Domestic”
Step 2
Then, use another Assign activity to extract the data, splitting the string based on the space: dateOnly = originalString.Split(" "c)(0)
In this case, the .Split(" "c) function splits the string on the white space, and (0) selects the first part of the string, which is the date .
This will output: dateOnly = “20/10/24”