Check if dateTime is a weekend or a weekday

You wrote wrong varable in the following if statement:

if ((dayToday == DayOfWeek.Saturday) || (dayToday == DayOfWeek.Sunday))
{
    Console.WriteLine("This is a weekend");
}

instead of dayToday you must use day varable in the condition.

UPDATE:
Also you made mistake in condition. There must be or instead of and.

Correct code is

if ((day == DayOfWeek.Saturday) || (day == DayOfWeek.Sunday))
{
    Console.WriteLine("This is a weekend");
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)