CurrentCulture.DateTimeFormat.LongTimePattern Read-only


I'm trying to set LongTimePattern property of CurrentCulture with the following code:

System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern = "HH:mm:ss";

and I'm getting InvalidOperationException: Instance is read-only.

Any idea how can I change it? I want to force LongTimePattern to show 24h format for any culture.

If you change the System.Threading.Thread.CurrentThread.CurrentCulture then it will automatically update the LongTimePattern.

You can't make any updation in current assigned culture info but create a new one and assign it to current culture.

System.Globalization.CultureInfo c = new System.Globalization.CultureInfo("es-ES");
c.DateTimeFormat.LongTimePattern = "h-mm-ss";
Thread.CurrentThread.CurrentCulture = c;