GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) Method

Definition

Returns the week of the year that includes the date in the specified DateTime object.

public:
 override int GetWeekOfYear(DateTime time, System::Globalization::CalendarWeekRule rule, DayOfWeek firstDayOfWeek);
[System.Runtime.InteropServices.ComVisible(false)]
public override int GetWeekOfYear (DateTime time, System.Globalization.CalendarWeekRule rule, DayOfWeek firstDayOfWeek);
override this.GetWeekOfYear : DateTime * System.Globalization.CalendarWeekRule * DayOfWeek -> int
Public Overrides Function GetWeekOfYear (time As DateTime, rule As CalendarWeekRule, firstDayOfWeek As DayOfWeek) As Integer

Parameters

time
DateTime DateTime DateTime DateTime

The DateTime object to read.

rule
CalendarWeekRule CalendarWeekRule CalendarWeekRule CalendarWeekRule

One of the CalendarWeekRule values that defines a calendar week.

firstDayOfWeek
DayOfWeek DayOfWeek DayOfWeek DayOfWeek

One of the DayOfWeek values that represents the first day of the week.

Returns

A 1-based integer that represents the week of the year that includes the date in the time parameter.

Exceptions

firstDayOfWeek is outside the range supported by the calendar.

-or-

rule is not a valid CalendarWeekRule value.

Applies to