Date Format Issue in one machine but working in other machines

Hi,
The same code is working in my previous machine and also working other machines even now, but I am facing the issues with this in my new machine only.

Imported System.Globalization but still same Issue. Its working fine after adding the datetimestyles.none. but adding this line to all these places will take much time to me. Is there any way to import explicitly.

Hi @logesh_kumar1

Try this

DateTime.ParseExact(str_SpouseDOB.ToString,{"MM-dd-yyyy","MM/dd/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd-MM-yyyy")

Regards,

Hi @logesh_kumar1

If you are working with multiple date formats then you need to add the syntax System.GLobalization.DateTimeStyles.None

DateTime.ParseExact(str_SpouseDOB, {"MM-dd-yyyy", "MM/dd/yyyy"},System.Globalization.CultureInfo.InvariantCulture, System.GLobalization.DateTimeStyles.None).ToString("dd-MM-yyyy")

But regarding the time this syntax doesn’t take much time, are you using this syntax inside any loop to convert from one date format to other.

If yes, it would be because your excel data is large. In that case, Linq expressions or Invoke Code will work.

Regards

Hi @vrdabberu I have tried to use this and its working fine. But in my project this particular line used in more than 50 assign statement and also its working in PROD without that datetimestyles.none.

Is there any other way to import that without adding it to all the places where i have used that conversion.

Hi @logesh_kumar1

Do you have many different date formats? please specify

Actually in the latest version you don’t have any other way to import that rather than adding that line @logesh_kumar1

Regards

Yeah, This line will works for me. But I have similar assign overall the project, I couldn’t make these changes now since the same code working in other machines.

Its only occurring now in my local machine.Is there any way to fix this without touching all these places? any explicit imports?

date formats two only, but for different validations I have these kind of assign statements in overall project. that’s why I required a explicit import to fix this . I couldn’t add this now since the same code working in prod.

This issue only occurring to my new machine only.

Are you using the latest version of Studio @logesh_kumar1

Regards

yes, I have download today only.

Hi @logesh_kumar1

In the latest version of studio, you need to add that particular syntax so that your error would be gone. There is no another option for this.

Regards

is there any way to download previous version of UiPath studio?

Hi @logesh_kumar1

While development, which version of Studio was used. If you have enterprise license you will have an option of downloading the previous version. But, only 5 previous version will be visible. If you are using Community edition, latest version of Studio will get downloaded i.e. 2024.10.0.

Regards

1 Like

Thank you, I have downloaded previous version and its working now

Hope your query is resolved @logesh_kumar1

If yes, please mark my post as solution to close the loop.

Regards

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