I've a web site which writes a date like this:
CultureInfo cultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures).FirstOrDefault(c => string.Equals(c.TwoLetterISOLanguageName, MvcApplication.Language));
return string.Concat(date.Day, ".", cultureInfo.DateTimeFormat.GetAbbreviatedMonthName(date.Month));
In both my PC (Windows 7, Service Pack 1, Spanish culture) and the server (Windows Server 2012, English Culture) the MvcApplication.Language
is es
so the culture I get from the list is: es-ES
.
I'd expect they both write the same string (they have different cultures, but I'm not using CurrentCulture
). However the results are abr
in my PC and Abr.
in the server.
I've tried this isolated from MvcApplication.Language
using the LinqPAD but it is still different. I've printed the arrays of AbbreviatedDayNames
and AbbreviatedMonthNames
and they are different in each computer.
Am I doing something wrong or this is the expected behavior? How can I do to make it completely independent from Windows / User Culture?