GetWeekOfYear() public method

public GetWeekOfYear ( DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek ) : int
time DateTime
rule CalendarWeekRule
firstDayOfWeek DayOfWeek
return int
示例#1
0
        private void setDateTime()
        {
            dpTime.SelectedDate = DateTime.Now;
            dynamic setTime = dpTime.SelectedDate;

            tbWeek.Text = "Week " + cal.GetWeekOfYear(setTime, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);
        }
 public void LeadingWeeks()
 {
     WeekDate = DateTime.Today;
     while (calendar.GetWeekOfYear(WeekDate, calendarWeekRule, dayOfWeek) > 1)
     {
         Week.Add(new WeekNumber(calendar.GetWeekOfYear(WeekDate, calendarWeekRule, dayOfWeek)));
         WeekDate = WeekDate.AddDays(-7);
     }
 }
示例#3
0
        public int WeekNum(DateTime date)
        {
            if ((date >= this.startDate) && (date <= this.endDate))
            {
                System.Globalization.Calendar cal = CultureInfo.InvariantCulture.Calendar;
                int swn = this.startWeekNum;
                int x   = cal.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
                if (this.halfTerm.HasValue)
                {
                    if ((date >= this.startDate) && (date < this.halfTerm.Value.StartDate))
                    {
                        int y = cal.GetWeekOfYear(this.startDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);

                        int a = ((((x - y) % 2) == 0) ? this.startWeekNum : this.startWeekNum + 1);
                        if (a == 3)
                        {
                            a = 1;
                        }
                        return(a);
                    }
                    else if ((date > this.halfTerm.Value.EndDate) && (date <= this.EndDate))
                    {
                        int y = cal.GetWeekOfYear(this.startDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
                        int a = ((((x - y) % 2) == 0) ? this.startWeekNum : this.startWeekNum + 1);
                        //if (this.startWeekNum == 2) a = (a == 2 ? 1 : 2);
                        if (a > 2)
                        {
                            a = 1;
                        }
                        a = a == 2 ? 1 : 2;
                        return(a);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else if ((date >= this.startDate) && (date <= this.endDate))
                {
                    int y = cal.GetWeekOfYear(this.startDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
                    int a = ((((x - y) % 2) == 0) ? this.startWeekNum : this.startWeekNum + 1);
                    if (a == 3)
                    {
                        a = 1;
                    }
                    return(a);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(-1);
            }
        }
示例#4
0
        public static long DateDiff(Recur.FrequencyType frequency, Date_Time dt1, Date_Time dt2, DayOfWeek firstDayOfWeek)
        {
            if (frequency == Recur.FrequencyType.YEARLY)
            {
                return(dt2.Year - dt1.Year);
            }

            if (frequency == Recur.FrequencyType.MONTHLY)
            {
                return((dt2.Month - dt1.Month) + (12 * (dt2.Year - dt1.Year)));
            }

            if (frequency == Recur.FrequencyType.WEEKLY)
            {
                // Get the week of year of the time frame we want to calculate
                int firstEvalWeek = _Calendar.GetWeekOfYear(dt2.Value, System.Globalization.CalendarWeekRule.FirstFourDayWeek, firstDayOfWeek);

                // Count backwards in years, calculating how many weeks' difference we have between
                // first and second dates
                Date_Time evalDate = dt2.Copy();
                while (evalDate.Year > dt1.Year)
                {
                    firstEvalWeek += _Calendar.GetWeekOfYear(new DateTime(evalDate.Year - 1, 12, 31), System.Globalization.CalendarWeekRule.FirstFourDayWeek, firstDayOfWeek);
                    evalDate       = evalDate.AddYears(-1);
                }

                // Determine the difference, in weeks, between the start date and the evaluation period.
                int startWeek = _Calendar.GetWeekOfYear(dt1.Value, System.Globalization.CalendarWeekRule.FirstFourDayWeek, firstDayOfWeek);
                return(firstEvalWeek - startWeek);
            }

            TimeSpan ts = dt2 - dt1;

            if (frequency == Recur.FrequencyType.DAILY)
            {
                return(Round(ts.TotalDays));
            }

            if (frequency == Recur.FrequencyType.HOURLY)
            {
                return(Round(ts.TotalHours));
            }

            if (frequency == Recur.FrequencyType.MINUTELY)
            {
                return(Round(ts.TotalMinutes));
            }

            if (frequency == Recur.FrequencyType.SECONDLY)
            {
                return(Round(ts.TotalSeconds));
            }

            return(0);
        }
        //----------------------------------------------------------------------------------------------

        //---- Constructor
        public MainWindow()
        {
            InitializeComponent();

            //-------------------------------------------------------- Carga configuraciones
            loadPreferences();

            //--------------------------------------------------------- Lista de actividades
            listaActividades = loadSavedActivities();
            if (listaActividades != null && listaActividades.Count > 0)
            {
                displaySavedActivities();
            }
            else
            {
                listaActividades = new List <ActividadesSheet>();
            }

            //--------------------------------------------------------- Fecha de TOP
            DateTime           temp = DateTime.Now;
            DateTimeFormatInfo dfi  = DateTimeFormatInfo.CurrentInfo;

            System.Globalization.Calendar cal = dfi.Calendar;
            label_Semana.Content = "Semana " + cal.GetWeekOfYear(temp, dfi.CalendarWeekRule, dfi.FirstDayOfWeek) + ", " + cal.GetYear(temp) + " " + getNameInitials(nombre_Usuario);

            //-------------------------------------------------------- Inicializa timer
            timersSettup();
        }
        //---- Aplica configuraciones
        private void button_ConfAplicar_Click(object sender, RoutedEventArgs e)
        {
            if (textBox_NombreUsuario.Text.Length < 1 && textBox_NombreUsuario.Text.Length < 1)
            {
                return;
            }

            nombre_Usuario      = textBox_NombreUsuario.Text;
            nombre_Gerente      = textBox_NombreGerente.Text;
            notificaciones_modo = comboBox_Notificaciones.SelectedIndex;
            recordatorio_activo = (bool)checkBox_Recordatorio.IsChecked;
            email_To            = textBox_EmailTo.Text;
            email_Cc            = textBox_EmailCc.Text;

            scroll_Actividades.Visibility   = Visibility.Visible;
            scroll_Configuracion.Visibility = button_ConfAplicar.Visibility = Visibility.Collapsed;

            //--------------------------------------------------------- Fecha de TOP
            DateTime           temp = DateTime.Now;
            DateTimeFormatInfo dfi  = DateTimeFormatInfo.CurrentInfo;

            System.Globalization.Calendar cal = dfi.Calendar;
            label_Semana.Content = "Semana " + cal.GetWeekOfYear(temp, dfi.CalendarWeekRule, dfi.FirstDayOfWeek) + ", " + cal.GetYear(temp) + " " + getNameInitials(nombre_Usuario);

            //---- Inicia los timers
            timersSettup();

            savePreferences();
        }
示例#7
0
        public int EndWeekNumber()
        {
            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

            System.Globalization.Calendar cal = dfi.Calendar;
            return(cal.GetWeekOfYear(EndTime, dfi.CalendarWeekRule, dfi.FirstDayOfWeek));
        }
    public int GetWeekOfYear(DateTime time)
    {
        DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

        System.Globalization.Calendar cal = dfi.Calendar;
        return(cal.GetWeekOfYear(time, dfi.CalendarWeekRule, DayOfWeek.Monday));
    }
示例#9
0
        private int GetWeekNumber(DateTime date)
        {
            System.Globalization.Calendar           calendar       = System.Threading.Thread.CurrentThread.CurrentCulture.Calendar;
            System.Globalization.DateTimeFormatInfo dateTimeFormat = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;

            return(calendar.GetWeekOfYear(date, dateTimeFormat.CalendarWeekRule, dateTimeFormat.FirstDayOfWeek));
        }
示例#10
0
        public static int GetWeekOfYear(DateTime date)
        {
            const string CULTURE = "de-CH";
            CultureInfo  ci      = new CultureInfo(CULTURE);

            System.Globalization.Calendar cal = ci.Calendar;
            return(cal.GetWeekOfYear(date, CalendarWeekRule.FirstDay, DayOfWeek.Monday));
        }
 /// <summary>
 /// lấy ra tuần theo ngày hiện tại
 /// </summary>
 /// <param name="time"></param>
 /// <returns></returns>
 public static int GetWeekOrderInYear(DateTime time)
 {
     CultureInfo myCI = CultureInfo.CurrentCulture;
     System.Globalization.Calendar myCal = myCI.Calendar;
     CalendarWeekRule myCWR = myCI.DateTimeFormat.CalendarWeekRule;
     DayOfWeek myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;
     return myCal.GetWeekOfYear(time, myCWR, myFirstDOW);
 }
示例#12
0
    private int GetWeekNumber(DateTime date)
    {
        DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

        System.Globalization.Calendar cal = dfi.Calendar;

        return(cal.GetWeekOfYear(date, dfi.CalendarWeekRule, dfi.FirstDayOfWeek));
    }
        private int GetWeeksInYear(int year, DateTime lastDayofYear)
        {
            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

            //DateTime date1 = new DateTime(year, 12, 31);
            System.Globalization.Calendar cal = dfi.Calendar;
            return(cal.GetWeekOfYear(lastDayofYear, dfi.CalendarWeekRule, dfi.FirstDayOfWeek));
        }
示例#14
0
    public int GetWeekNo(DateTime date)
    {
        System.Globalization.CultureInfo cult_info = System.Globalization.CultureInfo.CreateSpecificCulture("da-DA  ");
        System.Globalization.Calendar    cal       = cult_info.Calendar;
        int weekNo = cal.GetWeekOfYear(date, cult_info.DateTimeFormat.CalendarWeekRule, cult_info.DateTimeFormat.FirstDayOfWeek);

        return(weekNo);
    }
示例#15
0
    public static int Week(System.DateTime date)
    {
        System.Globalization.CultureInfo      ci  = new System.Globalization.CultureInfo("en-US");
        System.Globalization.Calendar         Cal = ci.Calendar;
        System.Globalization.CalendarWeekRule cwr = ci.DateTimeFormat.CalendarWeekRule;
        DayOfWeek dow = ci.DateTimeFormat.FirstDayOfWeek;

        return(Cal.GetWeekOfYear(date, cwr, dow));
    }
示例#16
0
        private int GetCurrentWeek()
        {
            DateTime CurrentDate = DateTime.Now;

            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

            System.Globalization.Calendar cal = dfi.Calendar;

            return(cal.GetWeekOfYear(CurrentDate, dfi.CalendarWeekRule, dfi.FirstDayOfWeek));
        }
示例#17
0
        public static int ToWeekOfYear()
        {
            CultureInfo ci = new CultureInfo("zh-CN");

            System.Globalization.Calendar cal = ci.Calendar;
            CalendarWeekRule rule             = ci.DateTimeFormat.CalendarWeekRule;
            DayOfWeek        dow = DayOfWeek.Monday;

            return(cal.GetWeekOfYear(DateTime.Now, rule, dow));
        }
示例#18
0
        public static int getWeek(DateTime date)
        {
            // Gets the DTFI properties required by GetWeekOfYear.
            CalendarWeekRule myCWR      = myCI.DateTimeFormat.CalendarWeekRule;
            DayOfWeek        myFirstDOW = DayOfWeek.Monday;//  myCI.DateTimeFormat.FirstDayOfWeek;

            var week = myCal.GetWeekOfYear(date, myCWR, myFirstDOW);

            return(week);
        }
示例#19
0
        private string GetDate(DateTime?dt)
        {
            DateTime ndt = (DateTime)dt;

            System.Globalization.Calendar objCal = CultureInfo.CurrentCulture.Calendar;
            int weekofyear = objCal.GetWeekOfYear(ndt, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);


            return(String.Format("{0:d} -  Kalenderwoche : {1}", ndt, weekofyear));
        }
示例#20
0
        private void RedirectToCurrentWeek()
        {
            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;

            System.Globalization.Calendar cal = dfi.Calendar;
            int currentWeek = cal.GetWeekOfYear(DateTime.Now, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);
            int currentYear = cal.GetYear(DateTime.Now);

            Response.Redirect("skema.aspx?aar=" + currentYear + "&uge=" + currentWeek);
        }
示例#21
0
        private static int GetWeekNumber(DateTime date)
        {
            System.Globalization.CultureInfo currentCulture  = System.Globalization.CultureInfo.CurrentCulture;
            System.Globalization.Calendar    currentCalendar = currentCulture.Calendar;

            return
                (currentCalendar.GetWeekOfYear(date,
                                               currentCulture.DateTimeFormat.CalendarWeekRule,
                                               currentCulture.DateTimeFormat.FirstDayOfWeek));
        }
示例#22
0
        public short GetNowWeekNumber()
        {
            CultureInfo myCI = new CultureInfo("en-US");

            System.Globalization.Calendar myCal = CultureInfo.InvariantCulture.Calendar;
            CalendarWeekRule myCWR      = myCI.DateTimeFormat.CalendarWeekRule;
            DayOfWeek        myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;

            return((short)myCal.GetWeekOfYear(DateTime.Now, myCWR, myFirstDOW));
        }
示例#23
0
        /// <summary>
        /// Weeks the specified td date.
        /// </summary>
        /// <param name="tdDate">The td date.</param>
        /// <returns></returns>
        private static int Week(DateTime tdDate)
        {
            CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;

            System.Globalization.Calendar         Cal = ci.Calendar;
            System.Globalization.CalendarWeekRule CWR = ci.DateTimeFormat.CalendarWeekRule;
            DayOfWeek FirstDOW = ci.DateTimeFormat.FirstDayOfWeek;

            return(Cal.GetWeekOfYear(tdDate, CWR, FirstDOW));
        }
示例#24
0
        /// <summary>
        /// 根据指定日期获得其所在周次
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public static string GetWeekNameByDate(DateTime date)
        {
            CultureInfo ci = new CultureInfo("zh-CN");

            System.Globalization.Calendar cal = ci.Calendar;
            CalendarWeekRule cwr = ci.DateTimeFormat.CalendarWeekRule;
            DayOfWeek        dow = DayOfWeek.Monday;
            int week             = cal.GetWeekOfYear(date, cwr, dow) - 1;

            return(week.ToString());
        }
示例#25
0
    protected int SetWeekNumber()
    {
        //week number calculation
        DateTimeFormatInfo dfi   = DateTimeFormatInfo.CurrentInfo;
        DateTime           date1 = DateTime.Today;

        System.Globalization.Calendar cal = dfi.Calendar;
        int wnr = cal.GetWeekOfYear(date1, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);

        return(wnr);
    }
示例#26
0
        /// <summary>
        /// 获取给定日期所在当年的周数
        /// </summary>
        /// <param name="giveDay"></param>
        /// <returns></returns>
        public static int GetWeekOfYear(this DateTime givenDay)
        {
            CultureInfo ci = new CultureInfo("zh-CN");

            System.Globalization.Calendar cal = ci.Calendar;
            CalendarWeekRule cwr = ci.DateTimeFormat.CalendarWeekRule;
            DayOfWeek        dow = DayOfWeek.Sunday;
            int week             = cal.GetWeekOfYear(givenDay, cwr, dow);

            return(week);
        }
示例#27
0
        public static int KW(DateTime Datum)
        {
            CultureInfo cultureInfo = new CultureInfo("de-DE");            // Ländereinstellung

            System.Globalization.Calendar calendar = cultureInfo.Calendar; // Objekt Kalender aufrufen


            int currentWeek = calendar.GetWeekOfYear(DateTime.Today, CalendarWeekRule.FirstDay, DayOfWeek.Monday); // Format festlegen

            return(currentWeek);                                                                                   // Kalenderwoche zurückgeben
        }
示例#28
0
        public int GetCurrentWeekOfYear()
        {
            //Getting the week number
            DateTimeFormatInfo dfi   = DateTimeFormatInfo.CurrentInfo;
            DateTime           date1 = DateTime.Today;

            System.Globalization.Calendar cal = dfi.Calendar;

            int weekOfYear = cal.GetWeekOfYear(date1, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);

            return(weekOfYear);
        }
示例#29
0
        /// <summary>
        /// Gets the first day of a week, modified from http://stackoverflow.com/a/19901870
        /// </summary>
        /// <param name="date">The date that will be used (week number will be calculated from this).</param>
        /// <param name="cal">The calendar to use to help finding the day.</param>
        /// <param name="calendarWeekRule">The calendar week rule to use to help finding the day.</param>
        /// <param name="firstDayOfWeek">The first day of the week to use to help finding the day.</param>
        /// <returns>The first day of the given week for the given year.</returns>
        static DateTime FirstDayOfWeek(DateTime date, System.Globalization.Calendar cal, CalendarWeekRule calendarWeekRule, DayOfWeek firstDayOfWeek)
        {
            var jan1       = new DateTime(date.Year, 1, 1);
            int daysOffset = (int)firstDayOfWeek - (int)jan1.DayOfWeek;

            // Minor fix, if firstDayOfWeek is not Sunday but jan1.DayOfWeek is, then 7 needs to be subtracted from the daysOffset to get the proper start of the week.
            if (firstDayOfWeek != DayOfWeek.Sunday && jan1.DayOfWeek == DayOfWeek.Sunday)
            {
                daysOffset = daysOffset - 7;
            }
            return(jan1.AddDays(daysOffset).AddDays(cal.GetWeekOfYear(date, calendarWeekRule, firstDayOfWeek) * 7 - 7));
        }
示例#30
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            //string [] test = {"123456789","987654321","Apfel","Birne"};
            //textBox1.Text = test.FirstOrDefault().ToString();

            var ntd = new DateTime(2012, 06, 01);

            System.Globalization.Calendar objCal = CultureInfo.CurrentCulture.Calendar;
            int weekofyear = objCal.GetWeekOfYear(ntd, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);

            MessageBox.Show(weekofyear.ToString());
        }
示例#31
0
        public Dictionary<string, List<SimpleDateTime>> GetWeeks(string dateTime, System.Globalization.Calendar cal, CultureInfo culture)
        {
            CurrentCalendar = cal;
            UserCulture = culture;
            DateTime safeDate = DateTime.Parse(dateTime);
            Dictionary<string, List<SimpleDateTime>> result = new Dictionary<string, List<SimpleDateTime>>();
            FirstWeekNum = CurrentCalendar.GetWeekOfYear(new DateTime(safeDate.Year, 1, 1), UserCulture.DateTimeFormat.CalendarWeekRule, UserCulture.DateTimeFormat.FirstDayOfWeek);
            CurrentWeekNum = CurrentCalendar.GetWeekOfYear(new DateTime(safeDate.Year, 1, 1), UserCulture.DateTimeFormat.CalendarWeekRule, UserCulture.DateTimeFormat.FirstDayOfWeek);
            LastWeekNum = CurrentCalendar.GetWeekOfYear(new DateTime(safeDate.Year, 12, 31), UserCulture.DateTimeFormat.CalendarWeekRule, UserCulture.DateTimeFormat.FirstDayOfWeek);

            int activeYear = safeDate.Year;
            int currentWeek = 0;
            int currentMonth = 0;
            List<DateTime> weekDays = new List<DateTime>();
            for (int month = 1; month <= 12; month++)
            {
                DateTime activeMonth = new DateTime(activeYear, month, 1, CurrentCalendar);
                int lastDayNum = activeMonth.AddMonths(1).AddDays(-1).Day;
                SimpleDateTime activeDay;
                int weekOfDay = 0;
                for (int day = 1; day <= lastDayNum; day++)
                {
                    activeDay = new SimpleDateTime(UserCulture.Name, new DateTime(activeYear, month, day, CurrentCalendar).ToString());
                    weekOfDay = CurrentCalendar.GetWeekOfYear(activeDay.BaseDate, UserCulture.DateTimeFormat.CalendarWeekRule, UserCulture.DateTimeFormat.FirstDayOfWeek);
                    if (result.Count() == 0 || !result.ContainsKey(weekOfDay.ToString()))
                    {
                        result.Add(weekOfDay.ToString(), new List<SimpleDateTime>());
                        result[weekOfDay.ToString()].Add(activeDay);
                    }
                    else
                    {
                        result[weekOfDay.ToString()].Add(activeDay);
                    }
                    currentWeek = weekOfDay;
                }
                currentMonth = month;
            }
            return result;
        }
示例#32
0
文件: Main.cs 项目: dosjos/VinLotteri
        //Initiate stuff
        public Main()
        {
            InitializeComponent();

            button2.Enabled = false;
            this.comboBox1.Items.AddRange(loadNames());

            myCI = new CultureInfo("en-US");
            myCal = myCI.Calendar;

            // Gets the DTFI properties required by GetWeekOfYear.
            myCWR = myCI.DateTimeFormat.CalendarWeekRule;
            myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;

            week = myCal.GetWeekOfYear(DateTime.Now, myCWR, myFirstDOW);
            numericUpDown2.Value = week;

            SetTitle();
            loadWeekSales();
        }
 private void ExecutePosTest(string errorNum1, string errorNum2, Calendar myCalendar, int year,
     int month, int day, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
 {
     DateTime time;
     int actualDayOfYear, expectedDayOfYear;
     int weekOfYear;
     time = myCalendar.ToDateTime(year, month, day, 0, 0, 0, 0);
     expectedDayOfYear = myCalendar.GetDayOfYear(time);
     weekOfYear = myCalendar.GetWeekOfYear(time, rule, firstDayOfWeek);
     actualDayOfYear = this.GetDayOfYear(time, rule, firstDayOfWeek, weekOfYear, myCalendar);
     Assert.Equal(expectedDayOfYear, actualDayOfYear);
 }
 /// <summary>
 /// Get's this week for a date.
 /// </summary>
 /// <param name="dateTime">The date time.</param>
 /// <param name="calendar">The calendar.</param>
 /// <param name="calendarWeekRule">The calendar week rule.</param>
 /// <param name="firstDayOfWeek">The first day of week.</param>
 /// <returns>The week.</returns>
 public static int WeekNumber(
         this DateTime dateTime,
         Calendar calendar = null,
         CalendarWeekRule calendarWeekRule = CalendarWeekRule.FirstFourDayWeek,
         DayOfWeek firstDayOfWeek = DayOfWeek.Sunday)
 {
     if (calendar == null)
         calendar = CultureInfo.CurrentCulture.Calendar;
     int weekNum = calendar.GetWeekOfYear(dateTime, calendarWeekRule, firstDayOfWeek);
     return ((weekNum > 51) && (calendar.GetMonth(dateTime) < 12)) ? 0 : weekNum;
 }
		public static int GetWeekOfYear(this DateTime date, 
			DayOfWeek firstDayOfWeek = DayOfWeek.Sunday, Calendar calendar = null)
		{
			if (calendar == null)
				calendar = _DefaultCalendar;
			
			return calendar.GetWeekOfYear(date, CalendarWeekRule.FirstDay, firstDayOfWeek);
		}
示例#36
0
        public static int Week( this DateTime date, Calendar calendar, CalendarWeekRule rule, DayOfWeek firstDayOfWeek )
        {
            Arg.NotNull( calendar, nameof( calendar ) );
            Contract.Ensures( Contract.Result<int>() > 0 );

            return calendar.GetWeekOfYear( date, rule, firstDayOfWeek );
        }