Determines whether the specified date is saturday. - CSharp System

CSharp examples for System:DateTime Day

Description

Determines whether the specified date is saturday.

Demo Code


using System;//from   ww w .  ja va  2  s. co m

public class Main{
        /// <summary>
        ///     Determines whether the specified date is saturday.
        /// </summary>
        /// <param name="date">The date.</param>
        /// <returns></returns>
        public static bool IsSaturday(this DateTime date)
        {
            DayOfWeek dayOfWeek = date.DayOfWeek;
            bool isSaturday = dayOfWeek == DayOfWeek.Saturday;
            return isSaturday;
        }
}

Related Tutorials