I was wondering on how to write a method that will return me a string which will contain the short day name, example:
public static string GetShortDayName(DayOfWeek day)
now if i call:
string monday = GetShortDayName(DayOfWeek.Monday);
I will get back "mo" if culture is en, or "lu" if culture is at example it.
try:
Or:
You can use "ddd" in in a custom format string to get the short day name. For example.
As suggestby @Loudenvier in comments.
Gets or sets a string array of the shortest unique abbreviated day names associated with the current DateTimeFormatInfo object.
You can use
DateTimeFormatInfo.AbbreviatedDayNames
. For example:The closest you can get is use a custom date and time format string - specifically
ddd
.This will return an abbreviation - you can substring the result to get to 2 characters.
You will need to use a
DateTime
with a day corresponding to the day of week you wish.