Unable to change Date format in Uipath

Hello everyone,
I have been trying to merge two excel sheets with different date formats in them but I am getting the number of days instead of the date in the short date format. One format is “08-Feb-02” while the other is “01-01-1999” and I want it in “01-01-1999” format. Can anyone please help.

1 Like

hi @jamnanin,

use this code to change date format (08-Feb-02 to 08-02-02)
DateTime.ParseExact(“08-Feb-02”, “dd-MMM-yy”, CultureInfo.InvariantCulture).ToString(“dd-MM-yy”)

Regards,
Arivu

1 Like

hi arivazhagan,
but where do i change it in the sequence

1 Like

Hi @jamnanin,

you are assign something to Values what is that???

Regards,
Arivu

1 Like

I am selecting the columns that I need by assigning “testRow.Select.CopyToDataTable().DefaultView.ToTable(False, “ID”, “Name”,“Insurance Amount”,“Dob”)” to values

1 Like

Hi @jamnanin,

Can you give more detail to better understand. Give some sample data with your xaml file

Regards,
Arivu

1 Like

this is the 1st file and
this is the 2nd file
and this is what i want as my final output

If you could send me a sample xaml on how to do this would be of great help. Thank you

1 Like

hi @arivu96,

is there a way to do this? I just want to know in which activity do i use the code? should i use an assign activity? if yes then what should i assign it to?

1 Like

Hi @jamnanin

yes, its possible. refer the xaml files.
MainDateFormatchange.xaml (13.1 KB)
input 1.xlsx (7.5 KB)
input 2.xlsx (7.5 KB)
Result.xlsx (8.7 KB)

Regards,
Arivu

1 Like

thanks a lot arivu for taking your time to help me out.

1 Like

hi @arivu96

I faced same issue, but my date format is different with this format… my date format is MM/dd/yyyy and i want to change it to dd/MM/yyyy.
I tried use your solution, but i got this error

image

can you help me with this?
Thank you

1 Like

@annisa.silvy After reading from excel please check which date format you getting by printing or displaying it.

1 Like

i change column format in excel as custom (MM/dd/yyyy) and i got this new error

image

How to fix that?

1 Like

@annisa.silvy Please check below thread.

1 Like

my excel format has changed to MM/dd/yyyy and i want to change that into dd/MM/yyyy. i don’t know how she fixed that… can you help me with this?
Thank you

1 Like

@annisa.silvy Check below both options

 DateTime.ParseExact(urdatestringvariable, “MM/dd/yy”,Nothing).ToString(“dd/MM/yy”)

 DateTime.ParseExact(urdatestringvariable.ToString.Split({" "},StringSplitOptions.RemoveEmptyEntries)(0).Trim, “MM/dd/yy”,Nothing).ToString(“dd/MM/yy”)

@annisa.silvy

That error is coming up because of / present in your date formatting . Can you please replace / with . (dot) or _ (underscore).

If you still get issue please revert , i have faced this situation before so i can help you.

Regards,
Ahtesham

hi @md.ahtesham

Could you please check this workflow… i still got error when reading range of excel.
Can you help me? Thank you
test.zip (17.5 KB)

hi @Manjuts90

how if i want to change format date in excel file like this ?

Can you help me with this?
Thank you

@annisa.silvy Please check output in sheet1 of excel. Let me know if you still have any issues.

test.zip (18.4 KB)