How to get the integer value of day of week

前端 未结 9 693
太阳男子
太阳男子 2020-12-02 18:15

How do I get the day of a week in integer format? I know ToString will return only a string.

DateTime ClockInfoFromSystem = DateTime.Now;
int day1;
string d         


        
9条回答
  •  一向
    一向 (楼主)
    2020-12-02 18:28

    The correct way to get the integer value of an Enum such as DayOfWeek as a string is:

    DayOfWeek.ToString("d")
    

提交回复
热议问题