Date format issue of excel file

I have one excel file in which there are too many columns some columns are date column.format of the date columns is 5/22/2023 00:10:00.I want to write date in this format-22-May-2023 00:10:00.how to do it in UiPath?

DateTime.ParseExact(dateST.ToString(),“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“dd/Mon/yyyy”)

1 Like

what is dateST.ToString() ? and how to use it?

Date.Tostring is variable and your case it wil coloumn value.

I have 5-7 columns.so how to use it?

Hi,

How about FormatCells activity as the following?

image

dd-mmmm-yyyy hh:mm:ss

OR

dd-mmm-yyyy hh:mm:ss

Regards,

1 Like

@Cuberoot So you want to convert 5-7 column value in this format. Right?
then put for loop and inside loop put one assign for each column and update all the columns

when i am using nested loop for each activity throws error implicit conversion of datarow to ienumerable.

@Cuberoot You need to put only one loop and inside loop put first assign activity.
left side put → Row(“YourColumn1”)
Right side put → DateTime.ParseExact(Row(“YourColumn1”).ToString,“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“dd/Mon/yyyy”)

same assign for others columns

if there are 7 columns,i have to use 7 assign activities?

@Cuberoot Yes. With one assign activity you need one more loop inside loop which will handle your columns name.

It shows this error-Assign: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

@Cuberoot Can you share excel file. and Zip code

Sure
by_status_total_tickets_2023_06_09_1406.xlsx (27.6 KB)
test3.xaml (85.7 KB)

@Cuberoot please share zip code only one file will not be open in UiPath

1 Like

@Cuberoot
brother full project folder:

Hi @Cuberoot

  1. Use read range activity and store it’s value in data table
  2. use for each row activity and iterate data table.
    Inside for each row use assign activity

Left side of assign write : currentrow(“yourDateColumnName”)

In write side of assign write :

DateTime.ParseExact(currentrow(“yourDateColumnName”).ToString(),“MM/dd/yyyy HH:mm:ss”,Globalization.CultureInfo.InvariantCulture).ToString(“dd/MMM/yyyy”)

This will solve your problem.

in some columns of date na is written so how to tackle it?

it shows this error-Assign: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

hi @Cuberoot

use format cell activity of excel. it will solve your problem.