To check the day of the week of the month

I have a date, for example, April 1, 2009. I want to know what a weekday is, that is, April 1 - Monday, Tuesday, etc. Similarly, I want to check the weekday of every day in April.

+3
source share
3 answers

You can use the DayOfWeek property .

+5
source

Use property DayOfWeek:

new DateTime(2009, 4, 1).DayOfWeek
+5
source

If your computer language does not optionally have a function DayOfWeek, you can use Zeller Congruence , which returns day-to-week using simple integer arithmetic.

0
source

Source: https://habr.com/ru/post/1705637/


All Articles