In C# / .NET it is possible to get integer value of day of week in following way.
DateTime.DayOfWeek property example
DateTime time = DateTime.Now; CultureInfo culture = CultureInfo.InvariantCulture; Console.WriteLine(time.ToString("dddd, dd MMMM yyyy HH:mm", culture)); Console.WriteLine((int)time.DayOfWeek);
Sunday, 18 August 2019 15:31 0
- To get day number it is necessary to make casting to integer.
- Days are counted from 0 (Sunday) to 6 (Saturday).