How to change the date format

hi
as my date format is dd/mm/yyyy but while am pasting to excel file the format gets change to
mm/dd/yyyy…can help me out with this.

Hi @sanjay21051990,

Try this code

DateTime.ParseExact(YourDateString.ToString(),"dd/MM/yyyy",Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")

Regards,
Arivu

1 Like

hi @arivu96
i want in this format dd/mm/yyyy but while writing into cell the format gets change to mm/dd/yyyy…so how should i over come this to get the same format dd/mm/yyyy?

if i wirte in this way ‘(DD/MM/yyy) it works but i need without (’).

use the above code
Inputpattern :dd/MM/yyyy
outputpattern :MM/dd/yyyy
DateTime.ParseExact(YourDateString.ToString(),Inputpattern,Globalization.CultureInfo.InvariantCulture).ToString(outputpattern)

Regards,
Arivu

1 Like

@sanjay21051990

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

Regards,
Mahesh

1 Like

So Excel is changing it for you?
If yes, Check your regional settings, as it’s not related to Uipath but to Excel itself.

1 Like