I need the weekdays abbreviation in different cultures. I have it in spanish already (hardcoded). Are there something already in .NET that has it already?
//string[] days = { "lunes", "martes", "miércoles", "jeuves", "viernes", "sábado", "domingo" };
string[] days = { "L", "M", "X", "J", "V", "S", "D" };
You're probably looking for DateTimeFormatInfo.AbbreviatedDayNames
Gets or sets a one-dimensional array of type String containing the culture-specific abbreviated names of the days of the week.
or DateTimeFormatInfo.ShortestDayNames
Gets or sets a string array of the shortest unique abbreviated day names associated with the current DateTimeFormatInfo object.
For example:
CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedDayNames
returns
on a de-DE
system.
Try to observe the CultureInfo
var culture = System.Globalization.CultureInfo.CurrentCulture;
var dayNames = culture.DateTimeFormat.AbbreviatedDayNames;
var shortNames = culture.DateTimeFormat.ShortestDayNames;
...
And it is there for any culture:
System.Globalization.CultureInfo.GetCultureInfo("cs")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With