Checks to see if the date is Saturday or Sunday - CSharp System

CSharp examples for System:DateTime Day

Description

Checks to see if the date is Saturday or Sunday

Demo Code

//   The contents of this file are subject to the New BSD
using System;// w w  w. j a  va2 s .c  o  m

public class Main{
        /// <summary>
    /// Checks to see if the date is Saturday or Sunday
    /// </summary>
    /// <param name="dt">The dt.</param>
    /// <returns>
    /// 	<c>true</c> if [is week end] [the specified dt]; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsWeekEnd(this DateTime dt) {
        return (dt.DayOfWeek == DayOfWeek.Saturday || dt.DayOfWeek == DayOfWeek.Sunday);
    }
}

Related Tutorials