Rediger

Del via


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);
[<System.Runtime.InteropServices.ComVisible(false)>]
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

The DateTime object to read.

rule
CalendarWeekRule

One of the CalendarWeekRule values that defines a calendar week.

firstDayOfWeek
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.

Attributes

Exceptions

firstDayOfWeek is outside the range supported by the calendar.

-or-

rule is not a valid CalendarWeekRule value.

Applies to