Date Copied is dd/MM/yyyy but when pasted becomes MM/dd/yyyy

Need advice

Example:
I copied this date: 12/04/2022 (dd/MM/yyyy) and when I paste to an Excel cell, it becomes MM/dd/yyyy

How do I paste exactly what I copied into Excel?

@ayeo22
It is occurred due to different formats in Excel sheet

Refer to this Video to change the Date format in Excel

any other way besides changing the Date format in Excel?

Hi @ayeo22

Check out the thread

Regards
Gokul

Hi @ayeo22

If you want the format of the excel column to be date then you need to change the format in excel…if you are ok with text then append the value with ‘ single quote at the start

Eg: ‘12/12/2022

Or if you want to format from code then use format cell activity

Cheers

How can I do this using Parse Exact?

Hi @ayeo22

How about this expression

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

You can update the format as per the requirement

Regards
Gokul

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.