GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- rule
- CalendarWeekRule
One of the CalendarWeekRule values that defines a calendar 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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.