Same Week As - CSharp System

CSharp examples for System:DateTime Week

Description

Same Week As

Demo Code


using System.Collections.Generic;
using System;//from w w  w  . j a v a  2  s .c  om

public class Main{
        public static bool SameWeekAs(this DateTime processDate, DateTime processDate1)
      {
         if (!processDate.SameMonthAs(processDate1))
            return false;

         return processDate.DayOfWeek == processDate1.DayOfWeek;
      }
        public static bool SameMonthAs(this DateTime processDate, DateTime processDate1)
      {
         if (processDate.Year != processDate1.Year)
            return false;

         return processDate.Month == processDate1.Month;
      }
}

Related Tutorials