How to get the month name in C#?

前端 未结 6 2054
深忆病人
深忆病人 2020-12-04 18:41

How does one go about finding the month name in C#? I don\'t want to write a huge switch statement or if statement on the month int. I

6条回答
  •  被撕碎了的回忆
    2020-12-04 19:23

    If you just want to use MonthName then reference Microsoft.VisualBasic and it's in Microsoft.VisualBasic.DateAndTime

    //eg. Get January
    String monthName = Microsoft.VisualBasic.DateAndTime.MonthName(1);
    

提交回复
热议问题