How to get the integer value of day of week

Solution 1:

Use

day1 = (int)ClockInfoFromSystem.DayOfWeek;

Solution 2:

int day = (int)DateTime.Now.DayOfWeek;

First day of the week: Sunday (with a value of zero)

Solution 3:

If you want to set first day of the week to Monday with integer value 1 and Sunday with integer value 7

int day = ((int)DateTime.Now.DayOfWeek == 0) ? 7 : (int)DateTime.Now.DayOfWeek;