Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Why is the DateTime with specified culture ´nl-NL´, written in culture that is set by the browser?

$
0
0

In Blazor Wasm, I use the following code to write today's date in LongDatePattern to the console. It works well for English, German, Spanish and French. But for Dutch, it writes the date in the browser's language setting style (en-US in my case)

@DateTime.Now.Date.ToString("D", new CultureInfo("en-US"))<br />@DateTime.Now.Date.ToString("D", new CultureInfo("de-DE"))<br />@DateTime.Now.Date.ToString("D", new CultureInfo("es-ES"))<br />@DateTime.Now.Date.ToString("D", new CultureInfo("fr-FR"))<br />@DateTime.Now.Date.ToString("D", new CultureInfo("nl-NL"))

Here's a Blazor fiddle.

Output:
Wednesday, July 17, 2024
Mittwoch, 17. Juli 2024
miércoles, 17 de julio de 2024
mercredi 17 juillet 2024
Wednesday, July 17, 2024

And here's a .net fiddle. In this fiddle the Dutch part is correct. Output:
Wednesday, July 17, 2024
Mittwoch, 17. Juli 2024
miércoles, 17 de julio de 2024
mercredi 17 juillet 2024
woensdag 17 juli 2024

What am I doing wrong in Blazor?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>