Questions & Answers

String '' was not recognized as a valid DateTime due to localization

We are trying to implement Arabic language support in our dot net Core application and facing some issues with DateTime conversions. In our APIs where we are passing the dates like below

enter image description here

But in the backend the dates are received as below when selected language is Arabic.

enter image description here

so wherever we are converting the string representation of dates to DateTime, we are getting exceptions. We have configured the localization in the startup file as below.

enter image description here

String '2023-01-16 07:43:43 ص' was not recognized as a valid DateTime.

How can we fix this issue and how can we have an easy fix of this as the dates are being used in almost entire application and seems like we will have to make a change in all the places to fix this?

2023-01-20 08:42:03
No matter what's your language, 2023-01-16 07:43:43 s is not a valid Datetime....
2023-01-20 08:42:03
@Rena that's Arabic format..
Answers(0) :