Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
CultureInfo changes based on computer settings

I am running a .NET 5 MVC Web Application through IIS both on my local machine and a remote server.

I have noticed a strange bug where the computer's local settings appear to affect the result of the CultureInfo class

In Windows 10, if I open Settings > Time & Language > Region, and click Change data formats so that my Short time is 24 hour, i.e. 13:40 vs 1:40 PM, then the result of CultureInfo will also change. I had always assumed that changing my computer settings should not affect .NETs built in cultures, and that they should be the same no matter what computer the code runs on, so:

CultureInfo.CreateSpecificCulture("en-US");

Should return the same CultureInfo object no matter what computer the code is running on or what Date & Time settings the user decides to use.

I initially wondered if perhaps I was using the CultureInfo class wrong, so I also tried:

new CultureInfo("en-US");

But the results were the same.

Is there some way to tell the CultureInfo class to use the default values for the culture and not the use the settings that I currently have on my computer?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

var culture = new CultureInfo("en-US", false);

The second parameter of the constructor (useUserOverride) means exactly that.

  • true use the system settings
  • false use the default culture settings
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda