ahmed4566
(Syed S Ahmed)
November 25, 2023, 5:19pm
1
Hi Guys I am trying to change the format excel column (Due Date) format from MM/dd/yyyy to yyyy/MM/dd without the time span?
Due date
12/13/2021 00:00:00
10/05/2023 00:00:00
10/03/2023 00:00:00
02/06/2023 00:00:00
11/03/2023 00:00:00
11/03/2023 00:00:00
08/21/2023 00:00:00
09/01/2023 00:00:00
09/08/2023 00:00:00
09/08/2023 00:00:00
09/08/2023 00:00:00
08/04/2023 00:00:00
09/19/2023 00:00:00
09/15/2023 00:00:00
09/15/2023 00:00:00
08/18/2023 00:00:00
rikulsilva
(Henrique Lima da Silva)
November 25, 2023, 5:43pm
2
Hi @ahmed4566
Try the Format Cells Activity
The UiPath Documentation Portal - the home of all our valuable information. Find here everything you need to guide you in your automation journey in the UiPath ecosystem, from complex installation guides to quick tutorials, to practical business...
sanjay3
(Sanjay)
November 25, 2023, 6:17pm
3
Hi @ahmed4566
How about this
row(0) = DateTime.ParseExact(row(0).ToString, “MM/dd/yyyy HH:mm:ss”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd”)
Parvathy
(PS Parvathy)
November 25, 2023, 8:12pm
4
Hi @ahmed4566
Try using Format Cells activity
Or
→ Use Read Range Workbook to read the excel and store the output in a datatable say dt.
→ Use For Each row in DataTable to iterate through dt.
→ inside the loop use below below syntax in assign activity
CurrentRow("Due Date") = DateTime.ParseExact(CurrentRow("Due Date").ToString, "MM/dd/yyyy HH:mm:s", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd")
→ Use to Write Range Workbook to write he data back to excel.
Hope it helps!!
Anil_G
(Anil Gorthi)
November 26, 2023, 5:13am
5
@ahmed4566
If it is needed on excel then use format cells activity
If you need it in your code o use some there then use the following in Invoke code with dt as in/out argument
Dt.AsEnumerable.ToList.ForEach(Sub(r) r("ColumnName") = Cdate(r("ColumnName").ToString).ToString("yyyy/MM/dd"))
This will convert all values in given column to the required destination format
Cheers
RajKumar_DC
(RajKumar Durai)
November 26, 2023, 5:25am
6
Hi @ahmed4566 ,
If you want activity based, try this workflow
Code
CDate(CurrentRow("Date").ToString).ToString("yyyy/MM/dd")
Xaml
Date.xaml (7.6 KB)
Thanks,
ahmed4566
(Syed S Ahmed)
November 26, 2023, 6:02am
7
Parvathy:
CurrentRow("Due Date")
Thank you Parvathy,Its working fine,
1 Like
system
(system)
Closed
November 29, 2023, 6:03am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.