Getting a short day name

前端 未结 5 2403
一生所求
一生所求 2021-02-18 13:51

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(Da         


        
5条回答
  •  天命终不由人
    2021-02-18 14:20

    You can use DateTimeFormatInfo.AbbreviatedDayNames. For example:

    string[] names = culture.DateTimeFormat.AbbreviatedDayNames;
    string monday = names[(int) DayOfWeek.Monday];
    

提交回复
热议问题