Getting a short day name

前端 未结 5 2257
一生所求
一生所求 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:05

    The closest you can get is use a custom date and time format string - specifically ffffd.

    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.

提交回复
热议问题