i have this
01
Mo
Aug
kind horrible format date coulmn and my firend convetted it to DD/MM(Months in word)
output is like ths
01Aug,02Aug, and so on
The year is 2022
here is what he have done
v_arr_ColumnName = v_dt_DB.Columns.Cast(Of DataColumn).where(function(col) System.Text.RegularExpressions.Regex.IsMatch(col.ToString,"\d+")).Select(function(x ) x.ToString.Replace(vbLf,"").Split(" "c)(0)+x.ToString.Replace(vbLf,"").Split(" "c)(6)).ToArray
for getting that kind of output
now i want to convert it to MM/DD/YYYY
output what i want is like this 8/1/2022 , i dont want 0 before a single number
eg 01 i want 1 (both for month and date)
1 Like
Gokul001
(Gokul Balaji)
November 24, 2022, 5:07am
2
Hi @sagar.raval
Can you share the sample input here with the format?
Gokul001
(Gokul Balaji)
November 24, 2022, 5:08am
3
Hi @sagar.raval
You can try with this expression
DateTime.ParseExact(StringInput.ToString,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
You can simply add the any number of date formats dd/MM/yyyy
Regards
Gokul
Please look at the DB(WDF) sheet in this Gsheets
Gokul001
(Gokul Balaji)
November 24, 2022, 5:17am
5
Can you share the Output also for that? @sagar.raval
output before implemening your solution
after implementing you solution there is an error
"Source: Assign
Message: String '01Aug' was not recognized as a valid DateTime.
Exception Type: System.FormatException"
Gokul001
(Gokul Balaji)
November 24, 2022, 5:31am
7
HI @sagar.raval
Try with this expression
DateTime.ParseExact("01Aug","ddMMM",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
Regards
Gokul
Thanks a lot it is working now ,just one last thing can you tell me how can remove the zero befor a single number date or month?
Gokul001
(Gokul Balaji)
November 24, 2022, 5:37am
9
Can you share the sample input and output? @sagar.raval
Gokul001
(Gokul Balaji)
November 24, 2022, 5:41am
10
HI @sagar.raval
If your input like this
01
11
12
05
You can try with Regex expression
System.Text.RegularExpressions.Regex.Replace(YourString,"^0","").Tostring
Regards
Gokul
Gokul001
(Gokul Balaji)
November 24, 2022, 5:42am
11
Hi @sagar.raval
Kindly close this topic by mark as solved it will help for other too.
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
Regards
Gokul
First, pick the cells that contain dates, then right-click and select Format Cells. Select Custom in the Number Tab, then type ‘dd-mmm-yyyy’ in the Type text box, then click okay. It will format the dates you specify.
Regards,
Will
hey thanks for the answer, sorry but can you help me one last time, actuallly the coulmn name was stored in an array of string but as in this expression
v_arr_ColumnName = DateTime.ParseExact(v_arr_ColumnName.ToString,"ddMMM",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
i cant able to pass array in place of string and i also want to store the output to the same array of string “v_arr_ColumnName”
after this first one
now its time for removing the zero
v_arr_ColumnName = System.Text.RegularExpressions.Regex.Replace(v_arr_ColumnName ,"^0","").ToString
Gokul001
(Gokul Balaji)
November 24, 2022, 7:20am
14
Hi @sagar.raval
Check out this XAML file
ArrayStringTest.xaml (9.4 KB)
Regards
Gokul
rajat.jain
(Rajat Jain)
November 24, 2022, 8:11am
15
@sagar.raval Please mark it as solution so that it can help other people
Thanks
system
(system)
Closed
November 27, 2022, 8:12am
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.