Determines whether the specified date is friday. - CSharp System

CSharp examples for System:DateTime Day

Description

Determines whether the specified date is friday.

Demo Code


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

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

Related Tutorials