Convert from fr-CA time to US time format

238 views Asked by At

I have a string datetime like this in fr-CA time : "16 août 1980".

How can i change this string to US time like "16 aug 1980" or "august 16 1980" using c#?

I need create a cultureinfo of this time?

1

There are 1 answers

4
Kinetic On BEST ANSWER

Yes, you need to specifiy the cultureInfo. In this case, you can use DateTime.ParseExact like so :

var myDate = "16 août 1980";
var dateConverted = DateTime.ParseExact(myDate, "D", CultureInfo.GetCultureInfo("fr-CA"));
var dateUs = dateConverted.ToString("MMMM dd, yyyy", CultureInfo.GetCultureInfo("en-US"));