Reputation: 950
Date format is changing based on the culture when I am using DateTime.ParseExact()
method.
I want to keep date in en-US
culture always. Please see the below code I am using.
var date = DateTime.ParseExact("21072016 10:12:20",
"ddMMyyyy HH:mm:ss",
new CultureInfo("en-US",false));
string ff = date.ToString("yyyyMMddHHmmss");
When changing culture to ar
it is converting date as in arabic calendar (16101437 10:12:20).
Upvotes: 4
Views: 927
Reputation: 471
CultureInfo cInfo = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = cInfo;
Thread.CurrentThread.CurrentUICulture = cInfo;
Upvotes: 2