How do you get the day of the week from a DateTime Variable

How do you get the day of the week from a DateTime Variable. I have been trying to do this (int)DayOfWeek.Monday == DeptDate.Value.Day
but its not working please can anyone assist me

To get day of the week, you should use DayOfWeek and not Day. Day will give you the numeric day portion of a date. For example, Value.Day for 26 June 2019 will give you 26 and not the day of the week. Try using this code instead:
DayOfWeek.Monday == DeptDate.Value.DayOfWeek

1 Like

thank you very much…it worked, now everything is fine