Checks to see if the date is a week day (Mon - Fri) - CSharp System

CSharp examples for System:DateTime Week

Description

Checks to see if the date is a week day (Mon - Fri)

Demo Code

//   The contents of this file are subject to the New BSD
using System;/*  w w  w  . ja v a2 s  . c o m*/

public class Main{
        /// <summary>
    /// Checks to see if the date is a week day (Mon - Fri)
    /// </summary>
    /// <param name="dt">The dt.</param>
    /// <returns>
    /// 	<c>true</c> if [is week day] [the specified dt]; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsWeekDay(this DateTime dt) {
        return (dt.DayOfWeek != DayOfWeek.Saturday && dt.DayOfWeek != DayOfWeek.Sunday);
    }
}

Related Tutorials