I\'m working on localizing a website in French. However I am not supposed to change the date format to French. It must remain as per en-us format even if the culture is set
In my case I had to set the language of the app, also determine if the language is right-to-left language, but also needed to keep the standard datetime format. So that was what I did:
string culture = "ar-SA";
//Set language and culture to Arabic
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(culture);
//But independent of language, keep datetime format same
DateTimeFormatInfo englishDateTimeFormat = new CultureInfo("en-CA").DateTimeFormat;
Thread.CurrentThread.CurrentCulture.DateTimeFormat = englishDateTimeFormat;