共用方式為


GregorianCalendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) 方法

定義

傳回年份中的週,包含指定 DateTime 物件中的日期。

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

參數

time
DateTime

要讀取的 DateTime 物件。

rule
CalendarWeekRule

其中一個 CalendarWeekRule 值,可定義行事曆週。

firstDayOfWeek
DayOfWeek

其中一個 DayOfWeek 值,表示一週的第一天。

傳回

從 1 起始的整數,表示 time 參數中日期所屬年份中的某週。

屬性

例外狀況

firstDayOfWeek 不在曆法支援的範圍內。

-或-

rule 不是有效的 CalendarWeekRule 值。

適用於