Determines whether the specified date is sunday. - CSharp System

CSharp examples for System:DateTime Day

Description

Determines whether the specified date is sunday.

Demo Code


using System;//from ww  w . j a va  2s  . c o  m

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

Related Tutorials