GetWeekOfYear() public static method

public static GetWeekOfYear ( System.DateTime moment, CultureInfo culture, CalendarWeekRule weekRule, DayOfWeek firstDayOfWeek, YearWeekType yearWeekType, int &year, int &weekOfYear ) : void
moment System.DateTime
culture System.Globalization.CultureInfo
weekRule CalendarWeekRule
firstDayOfWeek DayOfWeek
yearWeekType YearWeekType
year int
weekOfYear int
return void
Exemplo n.º 1
0
        }         // GetDayName

        // ----------------------------------------------------------------------
        public virtual int GetWeekOfYear(DateTime time)
        {
            int year;
            int weekOfYear;

            TimeTool.GetWeekOfYear(time, culture, yearWeekType, out year, out weekOfYear);
            return(weekOfYear);
        }         // GetWeekOfYear
Exemplo n.º 2
0
        }         // ComputeHashCode

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(DateTime moment, int weekCount, ITimeCalendar calendar)
        {
            int year;
            int weekOfYear;

            TimeTool.GetWeekOfYear(moment, calendar.Culture, calendar.YearWeekType, out year, out weekOfYear);
            return(GetPeriodOf(year, weekOfYear, weekCount, calendar));
        }         // GetPeriodOf
Exemplo n.º 3
0
        } // IsSameWeek

        // ----------------------------------------------------------------------
        public static bool IsSameWeek(DateTime left, DateTime right, CultureInfo culture,
                                      CalendarWeekRule weekRule, DayOfWeek firstDayOfWeek, YearWeekType weekType)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }

            // left
            int leftWeekOfYear;
            int leftYear;

            TimeTool.GetWeekOfYear(left, culture, weekRule, firstDayOfWeek, weekType, out leftYear, out leftWeekOfYear);

            // rught
            int rightWeekOfYear;
            int rightYear;

            TimeTool.GetWeekOfYear(right, culture, weekRule, firstDayOfWeek, weekType, out rightYear, out rightWeekOfYear);

            return(leftYear == rightYear && leftWeekOfYear == rightWeekOfYear);
        } // IsSameWeek
Exemplo n.º 4
0
        }         // WeekTimeRange

        // ----------------------------------------------------------------------
        protected WeekTimeRange(DateTime moment, int weekCount, ITimeCalendar calendar) :
            base(GetPeriodOf(moment, weekCount, calendar), calendar)
        {
            TimeTool.GetWeekOfYear(moment, calendar.Culture, calendar.YearWeekType, out year, out startWeek);
            this.weekCount = weekCount;
        }         // WeekTimeRange